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

What is the heap in c?

1077


What is bubble sort in c?

1048


Tell us two differences between new () and malloc ()?

1180


how many errors in c explain deply

2085


How can I remove the trailing spaces from a string?

1066


What are the two forms of #include directive?

1160


Write a program to swap two numbers without using the third variable?

1062


Explain the properties of union.

1080


C program execution always begins with a) #include b) comment (/*-------*/) c) main() d) declaration instructions

1051


Is struct oop?

1000


What is indirection? How many levels of pointers can you have?

1124


What is the process of writing the null pointer?

1026


What is double pointer in c?

1038


How many types of operator or there in c?

1089


What are structural members?

1004