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 is Dynamic memory allocation in C? Name the dynamic allocation functions.

562


Explain union. What are its advantages?

621


Why do we use header files in c?

588


How can I make sure that my program is the only one accessing a file?

686


Suppose we have a table name EMP as below. We want to perform a operation in which, I want to change name ‘SMITH’ from as ‘SMITH JAIN’. Also I want to change the name of the column from ENAME to E_NAME. EMPNO ENAME JOB MGR HIREDATE SAL 7369 SMITH Coder 7902 17-DEC-80 800 7499 ALLEN SALESMAN 7698 20-FEB-81 1600 7521 WARD SALESMAN 7698 22-FEB-81 1250

1513






How to implement a packet in C

2401


Explain what is output redirection?

670


What is %lu in c?

691


Explain is it valid to address one element beyond the end of an array?

742


What is context in c?

543


simple program of graphics and their output display

1471


Can a void pointer point to a function?

580


WHAT IS THE DEFINATION OF IN TECHNOLOGY AND OFF TECHNOLOGY ?

1862


Here is a neat trick for checking whether two strings are equal

568


Write a factorial program using C.

648