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
In this problem you are to write a program that will cut some number of prime numbers from the list of prime numbers between 1 and N.Your program will read in a number N; determine the list of prime numbers between 1 and N; and print the C*2 prime numbers from the center of the list if there are an even number of prime numbers or (C*2)-1 prime numbers from the center of the list if there are an odd number of prime numbers in the list.
How do I swap bytes?
What are keywords c?
How can a program be made to print the name of a source file where an error occurs?
What are the advantage of c language?
Write a program to print all permutations of a given string.
What is cohesion in c?
What are the 32 keywords in c?
Who invented bcpl language?
Write a C program to accept a matrix of any size. Find the frequency count of each element in the matrix and positions in which they appear in the matrix
Explain what are linked list?
What is a stream in c programming?
What is array of structure in c programming?
c language supports bitwise operations, why a) 'c' language is system oriented b) 'c' language is problem oriented c) 'c' language is middle level language d) all the above
What is a char c?