Have a Read!

Hi Everyone.
The idea for this page is to provide new c users simple c tutorials to learn how to develop the logic and more importantly correct way to write syntax.
ENJOY !!!

Thursday, January 27, 2011

C PROGRAM FOR NTH TERM OF FIBONACCI SERIES

#include<stdio.h>
int main()
{
int x=0,y=1,z,nth,i;
printf("\n\nPlease Enter The Term Number:");
scanf("%d",&nth);
for(i=1;i<=nth;i++)
{z=x+y;
x=y;
y=z;
}
printf("\nthe %dth term of Fibonacci Series is is %d\n\n\n",nth,z);
return 0;
}

1 comment:

Related Posts with Thumbnails