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...

write a program for fibonaci series by using while loop in c?

Answer Posted / rajendra raji

main()
{
int a=0,b=1,c,n;
printf("enter n value");
scanf("%d",&n);
Printf("%d%d",a,b);
n=n-2;
while(n>0)
{
c=a+b;
printf("%d",c);
a=b;
b=c;
n--;
}
}

Explanation:
Hi....
if you give n value as 5, then it will print 5 values including the first printed a and b values..!!
try it once.. it will definitely work..

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

how do you write a function that takes a variable number of arguments? What is the prototype of printf () function?

1938


What is modeling?

1054


Do you know the difference between exit() and _exit() function in c?

1062


What are the keywords in c?

1124


Explain with the aid of an example why arrays of structures don’t provide an efficient representation when it comes to adding and deleting records internal to the array.

3153


write a c program to print the next of a particular no without using the arithmetic operator or looping statements?

3970


What does sizeof return c?

1064


Is c procedural or functional?

1029


What is nested structure?

1043


What is the function of multilevel pointer in c?

1087


How does sizeof know array size?

1124


In c programming write a program that will print 10 multiples of 3 except 15,18,21 using looping

1514


What is a null pointer in c?

1232


c language interview questions & answer

1960


What is modifier & how many types of modifiers available in c?

1032