#include<stdio.h>
main()
{
int a=1,b=1,i=1,n,temp,j;
printf("\nEnter number of rows=");
scanf("%d",&n);
printf("\nThe fibonacci series is\n");
j=1;
while(j<=n)
{
a=1;
b=1;
i=1;
while(i<=j)
{
printf("%10d",a);
temp=a;
a=b;
b=temp+a;
i++;
}
printf("\n");
j++;
}
}
main()
{
int a=1,b=1,i=1,n,temp,j;
printf("\nEnter number of rows=");
scanf("%d",&n);
printf("\nThe fibonacci series is\n");
j=1;
while(j<=n)
{
a=1;
b=1;
i=1;
while(i<=j)
{
printf("%10d",a);
temp=a;
a=b;
b=temp+a;
i++;
}
printf("\n");
j++;
}
}
No comments:
Post a Comment