71 lines
1.0 KiB
C
71 lines
1.0 KiB
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
int main(void){
|
|
|
|
int tab1[2][5];
|
|
int i;
|
|
int j;
|
|
for(i=0;i<2;i++){
|
|
for(j=1;j<=5;j++){
|
|
tab1[i][j-1]=j;
|
|
}
|
|
}
|
|
|
|
int tab2[3][5];
|
|
int nb=1;
|
|
for(i=0;i<3;i++){
|
|
for(j=0;j<5;j++){
|
|
tab2[i][j]=nb;
|
|
nb++;
|
|
}
|
|
}
|
|
|
|
int tab3[5][5]={0};
|
|
nb=0;
|
|
for(i=0;i<5;i++){
|
|
for(j=1;j<=nb;j++){
|
|
tab3[i][j-1]=j;
|
|
}
|
|
nb++;
|
|
}
|
|
|
|
printf("%10s %17s %17s\n", "t1","t2","t3");
|
|
for(i=0;i<5;i++){
|
|
if(i<2){
|
|
for(j=0;j<5;j++){
|
|
printf("%3d",tab1[i][j]);
|
|
}
|
|
printf(" ");
|
|
for(j=0;j<5;j++){
|
|
printf("%3d",tab2[i][j]);
|
|
}
|
|
printf(" ");
|
|
for(j=0;j<5;j++){
|
|
printf("%3d",tab3[i][j]);
|
|
}
|
|
printf("\n");
|
|
}
|
|
if(i==2){
|
|
printf(" ");
|
|
for(j=0;j<5;j++){
|
|
printf("%3d",tab2[i][j]);
|
|
}
|
|
printf(" ");
|
|
for(j=0;j<5;j++){
|
|
printf("%3d",tab3[i][j]);
|
|
}
|
|
printf("\n");
|
|
}
|
|
if(i>2){
|
|
printf(" ");
|
|
for(j=0;j<5;j++){
|
|
printf("%3d",tab3[i][j]);
|
|
}
|
|
printf("\n");
|
|
}
|
|
|
|
}
|
|
|
|
return EXIT_SUCCESS;
|
|
} |