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
How do we open a binary file in Read/Write mode in C?
what is the role you expect in software industry?
Does free set pointer to null?
What does s c mean in text?
Calculate the weighted average of a list of n numbers using the formula xavg = f1x1+f2x2+ ….+ fnxn where the f’s are fractional weighting factors, i.e., 0<=fi<1, and f1+f2+….+fn = 1
hi to every one .. how to view table pool after creating the pooled table? plz help me.. if any knows abt this ..
Explain how do you determine whether to use a stream function or a low-level function?
What is difference between main and void main?
What are the primitive data types in c?
What does sizeof function do?
How can I generate floating-point random numbers?
Is fortran still used today?
What library is sizeof in c?
What are the valid places to have keyword “break”?
1) write a program to generate 1st n fibonacci prime numbers using Nested if 2) write a program to generate twin prime numbers from m to n using nested if 3) write a program to check whether a given integer is a strong number or not using nested if 4) Write a program to generate prime factors of a given integer using nested if 5)write a program to generate prime numbers from m to n using nested if 6)write a program to generate perfect numbers from m to n using nested if 7)write a program to generate the pallindromes from m to n using neste if 8)write a program to generate armstrong numbers from m to n using nested if 9)write a program to generate strong numbers from m to n using nested if