C PROGRAMC program to print the Fibonacci series#include<stdio.h>#include<conio.h>void main() { int n,first=0,second=1,next,a; clrscr(); printf("enter the number of terms"); scanf("%d",&n); for(a=0;a<n;a++) { if(a<=1) { next=a; printf ("%d",next); } else { first=second; second=next; next=first+second; printf("%d",first); } } getch(); }OUTPUT : enter the number of terms10011123581321Process finished.
No comments:
Post a Comment