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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the rules for identifiers in c?

589


what do the 'c' and 'v' in argc and argv stand for?

647


Is c compiled or interpreted?

668


What is meant by type casting?

629


What do you mean by invalid pointer arithmetic?

637






What are near, far and huge pointers?

649


What are operators in c?

584


What is calloc()?

630


Explain what math functions are available for integers? For floating point?

617


define string ?

669


What is the heap?

688


What is a null pointer assignment error? What are bus errors, memory faults, and core dumps?

906


Is null always equal to 0(zero)?

587


What is the purpose of the preprocessor directive error?

683


I need previous papers of CSC.......plz help out by posting them.......

1818