Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

coding for Fibonacci.?

Answer Posted / siggi

class hcl
{
public static void main(String arg[])
{int a=0;
int b=1;
int i=1;
int x,y;

/*System.out.println("enter the no.");*/
x=Integer.parseInt(arg[0]);
if(x==0 || x==1)
{ System.out.println("yes it is");}

else {

do
{
y=a+b;
if(x==y)
{ System.out.println("yes it is");
i=0;}
else if(x>y)
{a=b;
b=y;}
else
{ i=0;
System.out.println("no it is not");}

}while(i!=0);

}
}
}

Is This Answer Correct ?    1 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

There is a practice in coding to keep some code blocks in comment symbols than delete it when debugging. How this affect when debugging?

1251


What is use of integral promotions in c?

1088


What is a void * in c?

1031


Explain what is the use of a semicolon (;) at the end of every program statement?

1189


How can I invoke another program or command and trap its output?

1059


Explain the Difference between the New and Malloc keyword.

1092


How do I copy files?

1009


Is null equal to 0 in sql?

1101


main() { inta=10,b=20; a>=5?b=100:b=200; printf("%d ",b); }

1471


What is the difference between abs() and fabs() functions?

1070


Why doesnt long int work?

989


What is self-referential structure in c programming?

1155


What is a lvalue

1045


What are the advantages of c preprocessor?

1217


What is extern c used for?

1014