DEbut TP08

This commit is contained in:
2023-09-26 15:04:45 +02:00
parent b9b9fe9745
commit 990ad49385
7 changed files with 89 additions and 5 deletions

BIN
DEV1.1/TP07/progression Executable file

Binary file not shown.

21
DEV1.1/TP07/progression.c Normal file
View File

@@ -0,0 +1,21 @@
#include <stdio.h>
#include <stdlib.h>
int main(void) {
int u0=0,u1=1,utemp,nieme,terme;
printf("Donnez un entier : ");
scanf("%d",&nieme);
if (nieme==0)
printf("%d\n",u0);
else if (nieme==1)
printf("%d\n",u1);
else{
for (terme=2;terme<=nieme;terme++){
utemp=u0+u1;
u0=u1;
u1=utemp;
}
}
printf("%d\n",u1);
return EXIT_SUCCESS;
}

BIN
DEV1.1/TP07/table Executable file

Binary file not shown.

View File

@@ -3,11 +3,22 @@
#define TAILLE 10
int main(void) {
double forme_nombre,taille_carre=TAILLE^2,tour;
for (tour=0;taille_carre>10;tour++){
taille_carre/=10;
forme_nombre++;
int ligne,colonne,valeurs;
printf(" X |");
for (valeurs=0;valeurs<=TAILLE;valeurs++){
printf(" %5d",valeurs);
}
printf("\n------+");
for (valeurs=0;valeurs<=TAILLE;valeurs++){
printf("------");
}
printf("\n");
for (ligne=0; ligne<=TAILLE; ligne++){
printf("%5d |",ligne);
for (colonne=0; colonne<=TAILLE; colonne++){
printf(" %5d",colonne*ligne);
}
printf("\n");
}
for
return EXIT_SUCCESS;
}

31
DEV1.1/TP08/figures.c Normal file
View File

@@ -0,0 +1,31 @@
#include <stdio.h>
#include <stdlib.h>
int main(void) {
int hauteur_carre,etage,espace,forme,tour_etage,tour_etoile;
printf("t) Triangle \nc)Carré \nq)Quitter\n");
scanf("%c",&forme);
printf("Donnez un entier pour le nombre d'étage : ");
scanf("%d",&etage);
if (forme=='q')
printf("Au revoir ...\n");
else if (forme=='c') {
for (tour_etoile=0;tour_etoile<etage;tour_etoile++){
printf("* ");
for (hauteur_carre=0;hauteur_carre<(etage-2);hauteur_carre++){
for (espace=0;espace<(espace/2);espace++){
printf(" ");
}
for (tour_etage=0;tour_etage<etage;tour_etage++){
for (tour_espace=0;tour_espace<(espace/2);tour_espace++){
printf(" ");
}
for (tour_etoile=0;tour_etoile<nbr_etoile;tour_etoile++){
printf("*");
}
printf("\n");
nbr_etoile+=2;
espace-=2;
}
return EXIT_SUCCESS;
}

BIN
DEV1.1/TP08/sapin Executable file

Binary file not shown.

21
DEV1.1/TP08/sapin.c Normal file
View File

@@ -0,0 +1,21 @@
#include <stdio.h>
#include <stdlib.h>
int main(void) {
int nbr_etoile=1,etage,espace,tour_etage,tour_espace,tour_etoile;
printf("Donnez un entier pour le nombre d'étage : ");
scanf("%d",&etage);
espace=(etage-1)*2;
for (tour_etage=0;tour_etage<etage;tour_etage++){
for (tour_espace=0;tour_espace<(espace/2);tour_espace++){
printf(" ");
}
for (tour_etoile=0;tour_etoile<nbr_etoile;tour_etoile++){
printf("*");
}
printf("\n");
nbr_etoile+=2;
espace-=2;
}
return EXIT_SUCCESS;
}