0:21 AM midterm 2008-2009 Q2 |
1+1=2
1+2=3
2+3=5
3+5=8
5+8=13
#include"stdio.h"
main()
{
int x=1, y=1, z, n, i, j;
printf("enter number of raws : ");
scanf("%d", &n);
for(i=1;i<=n;i++){
for(j=1;j<=2*i-1;j++)
printf(" ");
z=x+y;
printf("%d+%d=%d\n", x, y, z);
x=y;
y=z;
}
getch();
return 0;
}
|
|
Total comments: 0 | |