#include <stdio.h> int main() { int a[25][25],i,j,k=1; for(i=1;i<=5;i++) { for(j=1;j<=i;j++) { a[i][j]=k; k++; } } for(i=1;i<=5;i++) { for(j=1;j<=i;j++) { printf("%2d",a[i][j]%10); } printf("\n"); } system("pause"); return 0; }
This is the output:
1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
0 comments:
Post a Comment