Fibonacci
Series
#include <stdio.h>
int main()
{
int i, n,
a1 = 0, a2 = 1, n1= 0;
printf("Enter the number of terms: ");
scanf("%d",&n);
printf("Fibonacci Series: %d, %d, ", a1, a2);
for (i=3;
i <= n; ++i)
{
n1 =
a1 + a2;
a1 =
a2;
a2 =
n1;
printf("%d, ",n1);
}
return 0;
}
0 comments:
Post a Comment
if you have any doubt please let me know