compute the nth mumber in the fibonacci sequence?
Answer Posted / sree
#include<stdio.h>
#include<conio.h>
void main()
{
int n,a=-1,b=1,c;
printf("Enter n:");
scanf("%d",&n);
for(int i=0;i<=n;i++)
{
c=a+b;
a=b;
b=c;
}
printf("Answer:%d",c);
}
| Is This Answer Correct ? | 9 Yes | 6 No |
Post New Answer View All Answers
In which header file is the null macro defined?
Explain the difference between malloc() and calloc() in c?
What is const volatile variable in c?
How can I call fortran?
Explain what are linked list?
cavium networks written test pattern ..
Can true be a variable name in c?
how do you write a function that takes a variable number of arguments? What is the prototype of printf () function?
What are local static variables? How can you use them?
What is wrong with this declaration?
Explain how can I right-justify a string?
How can you pass an array to a function by value?
What are pointers?
Write a program to input the price of 1 burger and the number of burgers eaten by a group of friends .print the total amount to be paid by the group?
What is the best way of making my program efficient?