pc005.c (516B)
1 /* Pattern : 2 1 3 1 2 4 3 5 8 5 13 21 34 55 6 89 144 233 377 610 7 for n = 5 8 */ 9 10 #include <stdio.h> 11 int main() 12 { 13 int i, j, n; 14 long long temp1 = 0, temp2 = 1, temp3; 15 printf("Enter n : "); 16 scanf("%d", &n); 17 printf("1\n"); 18 for (i = 2; i <= n; i++) 19 { 20 for (j = 1; j <= i; j++) 21 { 22 temp3 = temp1 + temp2; 23 printf("%lld\t", temp3); 24 temp1 = temp2; 25 temp2 = temp3; 26 } 27 printf("\n"); 28 } 29 return 0; 30 }