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
‘SAVEPOINT’ and ‘ROLLBACK’ is used in oracle database to secure the data comment. Give suitable examples of each with sql command.
In c programming language, how many parameters can be passed to a function ?
What is strcmp in c?
what is uses of .net
What is meant by recursion?
Combinations of fibanocci prime series
What is variable in c example?
What is variable declaration and definition in c?
Can a pointer be null?
What is %lu in c?
How can you allocate arrays or structures bigger than 64K?
What is the maximum no. of arguments that can be given in a command line in C.?
What happens if header file is included twice?
stripos — Find position of first occurrence of a case- insensitive string int stripos ( char* haystack, char* needle, int offset ) Returns the numeric position of the first occurrence of needle in the haystack string. Note that the needle may be a string of one or more characters. If needle is not found, stripos() will return -1. The function should not make use of any C library function calls.
Explain what is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?