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
how do you write a function that takes a variable number of arguments? What is the prototype of printf () function?
What is modeling?
Do you know the difference between exit() and _exit() function in c?
What are the keywords in c?
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.
write a c program to print the next of a particular no without using the arithmetic operator or looping statements?
What does sizeof return c?
Is c procedural or functional?
What is nested structure?
What is the function of multilevel pointer in c?
How does sizeof know array size?
In c programming write a program that will print 10 multiples of 3 except 15,18,21 using looping
What is a null pointer in c?
c language interview questions & answer
What is modifier & how many types of modifiers available in c?