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?

Answers were Sorted based on User's Feedback



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

Answer / 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

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

Answer / shamantha

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

Is This Answer Correct ?    1 Yes 2 No

Post New Answer

More C Interview Questions

what is the diff b/w static and non static variables in C. Give some examples plz.

3 Answers   Wipro,


What is p in text message?

0 Answers  


Explain how do you search data in a data file using random access method?

0 Answers  


While(1) { } when this loop get terminate is it a infinite loop?

5 Answers  


plz answer..... a program that reads non-negative integer and computes and prints its factorial

2 Answers  


What is the difference between exit() and _exit() function in c?

0 Answers  


Write a c pgm for leap year

11 Answers   College School Exams Tests, IBM, TCS,


what will be the output of "printf("%d%d",scanf("%d% d",&a,&b))".provide an explation regarding the question

6 Answers  


Why dont c comments nest?

0 Answers  


which is the best antivirus and how to update it

7 Answers   Infosys,


What is signed and unsigned?

0 Answers  


What is file in c preprocessor?

0 Answers  


Categories