DEV_BUT1/DEV1.1/TP09/horizontal.c

74 lines
1.3 KiB
C

/******************************************************************************
Online C Compiler.
Code, Compile, Run and Debug C program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <stdio.h>
int main()
{
int t1 [2][5];
int i;
int a;
int c = 0;
for(a=0; a<2; a++){
for(i=1; i<=5; i++){
t1[c][i] = i;
}
c++;
}
int t2 [3][5];
int g;
int r;
int z=1;
int e = 0;
for(r=0; r<3; r++){
for(g=0; g<5; g++){
t2[e][g] = z;
z++;
}
e++ ;
}
int be;
int ba;
int acc = 0;
int bouc;
int t3[5][5];
for(be=0; be<5; be++){
for(ba=0; ba<5; ba++){
if (ba >= be){
t3[be][ba] = 0;
}
else{
t3[be][ba] = ba+1;
}
}
printf("\n");
}
int o;
int m;
for(o = 0; o < 5; o++){
if (o<=2){
for(m = 1; m <=5; m++){
printf("[%d]", t1[o][m]);
}
printf(" ");
}
if (o<4){
for(be=0; be<5; be++){
printf("[%d]", t2[o][be]);
}
printf(" ");
}
for(ba = 0; ba<5; ba++){
printf("[%d]", t3[o][ba]);
}
}
printf("\n");
}
return 0;
}