compute the nth mumber in the fibonacci sequence?

Answer Posted / manish soni tagore collage jai

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,sum,n,cnt;
printf("Enter the number");
scanf("%d",&n);
for(a=0,b=1,cnt=1;cnt<=n;cnt++)
{
sum=a+b;
printf("%d\t",sum);

a=b;
b=sum;
}
getch();

}

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is external variable in c?

618


What is the difference between functions abs() and fabs()?

651


what are # pragma staments?

1632


Why is sprintf unsafe?

621


What tq means in chat?

584






How we can insert comments in a c program?

636


What are the two types of functions in c?

572


Can we increase size of array in c?

544


Why is C language being considered a middle level language?

658


what is the differnce between programing langauge and tool? is sas is a programing langauge r tool?

1909


Explain the difference between the local variable and global variable in c?

606


When is a “switch” statement preferable over an “if” statement?

653


What are c header files?

584


Is python a c language?

555


Give the rules for variable declaration?

682