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
What is the heap in c?
What is bubble sort in c?
Tell us two differences between new () and malloc ()?
how many errors in c explain deply
How can I remove the trailing spaces from a string?
What are the two forms of #include directive?
Write a program to swap two numbers without using the third variable?
Explain the properties of union.
C program execution always begins with a) #include b) comment (/*-------*/) c) main() d) declaration instructions
Is struct oop?
What is indirection? How many levels of pointers can you have?
What is the process of writing the null pointer?
What is double pointer in c?
How many types of operator or there in c?
What are structural members?