C programming Program to print the Fibonacci series up to n numbers.

Program to print the Fibonacci series up to n numbers. Write its pseudo code.Use a for loop.kindly provide a programme using c. Algorithm: step1:start step2:declare a,b,c,n,i step3:initialise a=0,b=1 step4:display enter the limit step5:read n step6:display a,b step7:swap the values,a=b,b=c step8:calculate c=a+b step9:displayc step10:update I to I+1 step11:checkwhether(I<=n) if true go to step7 else go to step12 step12:stop

  • Sree
  • 19 जुलाई
  • 3901 दृश्य
  • 1 उत्तर
Your Answer

#include<stdio.h>
#include<conio.h>
void main()
{
int a=0,b=1,c,n,i;
clrscr();
printf("enter the limit\n");
scanf("%d",&n);
for(i=2;i<n;i++)
{
c=a+b;
a=b;
b=c;
printf("%d\t",c);
}
getch();
}

0
c programming
मॉक परीक्षण अभ्यास के लिए
c programming