compute the nth mumber in the fibonacci sequence?
Answer Posted / d. prashant
#include<stdio.h>
#include<conio.h>
void main()
{
int a =0,b=1,c,i=2,n;
clrscr();
printf("Enter N Value : ");
scanf("%d",&n);
printf("%d\t%d\t",a,b);
while(n>i)
{
c = a+b;
printf("%d\t",c);
c=b;
b=a;
i++;
}
getch();
}
Is This Answer Correct ? | 3 Yes | 1 No |
Post New Answer View All Answers
What are the characteristics of arrays in c?
Lists the benefits of c programming language?
What is the difference between printf and scanf in c?
How to create struct variables?
Program to find the sum of digits of a given number until the sum becomes a single digit. (e.g. 12345=>1+2+3+4+5=15=>1+5=6)
What is size of union in c?
The __________ attribute is used to announce variables based on definitions of columns in a table?
please explain every phase in the "SDLC" in the dotnet.
the factorial of non-negative integer n is written n! and is defined as follows: n!=n*(n-1)*(n-2)........1(for values of n greater than or equal to 1 and n!=1(for n=0) Perform the following 1.write a c program that reads a non-negative integer and computes and prints its factorial. 2. write a C program that estimates the value of the mathematical constant e by using the formula: e=1+1/!+1/2!+1/3!+.... 3. write a c program the computes the value ex by using the formula ex=1+x/1!+xsquare/2!+xcube/3!+....
When should a type cast not be used?
main() { int i = 10; printf(" %d %d %d ", ++i, i++, ++i); }
How do I round numbers?
The postoder traversal is 7,14,3,55,22,5,17 Then ur Inorder traversal is??? please help me on this
Does sprintf put null character?
What is #include stdio h?