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
Explain what is the difference between far and near ?
What are Macros? What are its advantages and disadvantages?
Tell me what is the purpose of 'register' keyword in c language?
What is the scope of global variable in c?
How can I write functions that take a variable number of arguments?
Describe the steps to insert data into a singly linked list.
Should a function contain a return statement if it does not return a value?
How can I write a function that takes a format string and a variable number of arguments?
A banker has a seif with a cipher. Not to forget the cipher, he wants to write it coded as following: each digit to be replaced with the difference of 9 with the current digit. The banker chose a cipher. Decipher it knowing the cipher starts with a digit different than 9. I need to write a program that takes the cipher from the keyboard and prints the new cipher. I thought of the following: Take the input from the keyboard and put it into a string or an array. Go through the object with a for and for each digit other than the first, substract it from 9 and add it to another variable. Print the new variable. Theoretically I thought of it but I don't know much C. Could you give me any kind of hint, whether I am on the right track or not?
What are the standard predefined macros?
How can you draw circles in C?
#define f(g,h) g##h main O int i=0 int var=100 ; print f ("%d"f(var,10));} wat would be the output??
what is use of malloc and calloc?
Write a factorial program using C.
How does placing some code lines between the comment symbol help in debugging the code?