To print numbers in the Fibonacci

 


To print numbers in the Fibonacci sequence, you can create a C program that generates the Fibonacci sequence up to a specified limit. Here's an example:

c
#include<stdio.h>
int main()
{
int n,a=0,b=1,c,i;
printf("Enter number=");
scanf("%d",&n);

for(i=1;i<=n;i++)
{
printf(" %d",a);
c=a+b;
a=b;
b=c;
}

return 0;
}
output:- 
Enter number= 10
0, 1, 1, 2, 3, 5, 8, 13, 21, 34

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.