compute the nth mumber in the fibonacci sequence?
Answer Posted / selloorhari
// n th number of a fibonacci series
#include<stdio.h>
#include<conio.h>
void main ()
{
int i,k = 0 , j = 1 ,n,res;
printf ( " \n enter the number " );
scanf ( "%d",&n ) ;
// printf ( "\n the series is 0, 1" ) ;
for ( i= 2 ; i<n;i++ )
{
res= k+j ;
k=j;
j=res;
// printf ( ", %d" ,res ) ;
}
printf ( " \n The n th term is %d " ,res ) ;
getch() ;
}
| Is This Answer Correct ? | 10 Yes | 1 No |
Post New Answer View All Answers
Is a house a mass structure?
What is the mean of function?
What is character constants?
Hi how many types of software editions are there and their difference (like home editions, enterprise, standard etc) can u please help me
Explain what is the difference between #include and #include 'file' ?
An integer that indentifies the position of a data item in a sequence of data items a) value b) number c) index d) all of the above
Can we access array using pointer in c language?
What is the default value of local and global variables in c?
if p is a string contained in a string?
What is the value of c?
Explain what is a 'locale'?
What is the use of header?
what are non standard function in c
Is fortran still used today?
Write a program which returns the first non repetitive character in the string?