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
Can we declare a function inside a function in c?
What is include directive in c?
What is a union?
what is the different bitween abap and abap-hr?
What is keyword with example?
What is a substring in c?
Want to know how to write a C program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the total number of disk writes by MySQL.
When do you not use the keyword 'return' when defining a function a) Always b) Never c) When the function returns void d) dfd
Calculate the weighted average of a list of n numbers using the formula xavg = f1x1+f2x2+ ….+ fnxn where the f’s are fractional weighting factors, i.e., 0<=fi<1, and f1+f2+….+fn = 1
What is storage class?
What is void main ()?
What is the incorrect operator form following list(== , <> , >= , <=) and what is the reason for the answer?
What does sizeof function do?
i = 25;switch (i) {case 25: printf("The value is 25 ");case 30: printf("The value is 30 "); When the above statements are executed the output will be : a) The value is 25 b) The value is 30 c) The value is 25 The value is 30 d) none
Explain how do you search data in a data file using random access method?