18 Octobre

This commit is contained in:
Adrian POURCHOT 2022-10-18 11:29:05 +02:00
parent d6fccd8f37
commit 5237323aa0
3 changed files with 175 additions and 0 deletions

View File

@ -0,0 +1,75 @@
#include <stdio.h>
#include <stdlib.h>
int main() {
int t1[2][5];
int t2[3][5];
int t3[5][5];
int t4[5][2];
int t5[5][3];
int t6[5][5];
int i;
int j;
int v;
printf(" t1 t2 t3 t4 t5 t6\n");
for (i=0;i<5;i++){
v=0;
if (i<2){
for (j=0;j<5;j++){
v++;
t1[i][j]=v;
printf("%d ",t1[i][j]);
}
} else{
printf(" ");
} printf(" ");
v=0;
if (i<3){
v=i*5;
for (j=0;j<5;j++){
v++;
t2[i][j]=v;
printf("%2d ",t2[i][j]);
}
} else{
printf(" ");
} printf(" ");
v=0;
for (j=0;j<5;j++){
if (i>j){
v=j+1;
t3[i][j]=v;
printf("%d ",t3[i][j]);
} else{
v=0;
t3[i][j]=v;
printf("%d ",t3[i][j]);
}
} printf(" ");
v=0;
for (j=0;j<2;j++){
v=i+1;
t4[i][j]=v;
printf("%d ",t4[i][j]);
} printf(" ");
v=i+1;
for (j=0;j<3;j++){
t5[i][j]=v;
printf("%2d ",t5[i][j]);
v+=5;
} printf(" ");
v=0;
for (j=0;j<5;j++){
if (i<j){
v=i+1;
t6[i][j]=v;
printf("%d ",t6[i][j]);
} else{
v=0;
t3[i][j]=v;
printf("%d ",t3[i][j]);
}
} printf("\n");
} printf("\n");
return 0;
}

View File

@ -0,0 +1,77 @@
#include <stdio.h>
#include <stdlib.h>
int main() {
int t1[2][5];
int t2[3][5];
int t3[5][5];
int t4[5][2];
int t5[5][3];
int t6[5][5];
int i;
int j;
int v;
printf(" t1\n");
for (i=0;i<2;i++){
v=0;
for (j=0;j<5;j++){
v++;
t1[i][j]=v;
printf("%d ",t1[i][j]);
} printf("\n");
} printf("\n t2\n");
v=0;
for (i=0;i<3;i++){
for (j=0;j<5;j++){
v++;
t2[i][j]=v;
printf("%2d ",t2[i][j]);
} printf("\n");
} printf("\n t3\n");
v=0;
for (i=0;i<5;i++){
for (j=0;j<5;j++){
if (i>j){
v=j+1;
t3[i][j]=v;
printf("%d ",t3[i][j]);
} else{
v=0;
t3[i][j]=v;
printf("%d ",t3[i][j]);
}
} printf("\n");
}
printf(" t4\n");
for (i=0;i<5;i++){
for (j=0;j<2;j++){
v=i+1;
t4[i][j]=v;
printf("%d ",t4[i][j]);
} printf("\n");
} printf("\n t5\n");
v=0;
for (i=0;i<5;i++){
v=i+1;
for (j=0;j<3;j++){
t5[i][j]=v;
printf("%2d ",t5[i][j]);
v+=5;
} printf("\n");
} printf("\n t6\n");
v=0;
for (i=0;i<5;i++){
for (j=0;j<5;j++){
if (i<j){
v=i+1;
t6[i][j]=v;
printf("%d ",t6[i][j]);
} else{
v=0;
t6[i][j]=v;
printf("%d ",t6[i][j]);
}
} printf("\n");
}
return 0;
}

View File

@ -0,0 +1,23 @@
#include <stdio.h>
#include <stdlib.h>
int main() {
int Pas[30][30];
int i;
int j;
Pas[0][0]=1;
Pas[1][0]=1;
Pas[1][1]=1;
printf("%3d\n%3d %3d\n",Pas[0][0],Pas[1][0],Pas[1][1]);
for (i=2;i<30;i++){
Pas[i][0]=1;
Pas[i][i]=1;
printf("%3d ",Pas[i][0]);
for (j=1;j<i;j++){
Pas[i][j] = Pas[i-1][j] + Pas[i-1][j-1];
printf("%3d ",Pas[i][j]);
} printf("%3d ",Pas[i][i]);
printf("\n");
}
return 0;
}