write a program for fibonaci series by using while loop in c?
Answers were Sorted based on User's Feedback
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 |
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 |
implement NAND gate logic in C code without using any bitwise operatior.
Do you know what is a programing language ?
What is the use of c language in real life?
int i=0,j; j=++i + ++i ++i; printf(" %d",j);
find second largest element in array w/o using sorting techniques? use onle one for loop.
15 Answers BitWise, Zycus Infotech,
how write a addtion of two single dimensional array using of pointer in c language?
Explain the Difference between the New and Malloc keyword.
Is c dynamically typed?
Explain the bubble sort algorithm.
write a C program: To recognize date of any format even formats like "feb-02-2003","02-february-2003",mm/dd/yy, dd/mm/yy and display it as mm/dd/yy.
When should you use a type cast?
What are the general description for loop statement and available loop types in c?