Fin TP08
This commit is contained in:
BIN
DEV1.1/TP08/diviseur
Executable file
BIN
DEV1.1/TP08/diviseur
Executable file
Binary file not shown.
27
DEV1.1/TP08/diviseur.c
Normal file
27
DEV1.1/TP08/diviseur.c
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
int valeur1,valeur2,valeur_temp,pgcd=-1;
|
||||||
|
printf("Donnez le premier entier : \n");
|
||||||
|
scanf("%d",&valeur1);
|
||||||
|
printf("Donnez le deuxieme entier : \n");
|
||||||
|
scanf("%d",&valeur2);
|
||||||
|
while(pgcd==-1)
|
||||||
|
{
|
||||||
|
if (valeur2==0)
|
||||||
|
{
|
||||||
|
pgcd=valeur1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
valeur_temp=valeur1%valeur2;
|
||||||
|
valeur1=valeur2;
|
||||||
|
valeur2=valeur_temp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("%d\n",pgcd);
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
BIN
DEV1.1/TP08/figures
Executable file
BIN
DEV1.1/TP08/figures
Executable file
Binary file not shown.
@@ -3,29 +3,38 @@
|
|||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
int hauteur_carre,etage,espace,forme,tour_etage,tour_etoile;
|
int hauteur_carre,etage,espace,forme,tour_etage,tour_etoile;
|
||||||
|
do{
|
||||||
printf("t) Triangle \nc)Carré \nq)Quitter\n");
|
printf("t) Triangle \nc)Carré \nq)Quitter\n");
|
||||||
scanf("%c",&forme);
|
scanf("%c",&forme);
|
||||||
|
if (forme=='q')
|
||||||
|
break;
|
||||||
|
else if (forme=='c') {
|
||||||
printf("Donnez un entier pour le nombre d'étage : ");
|
printf("Donnez un entier pour le nombre d'étage : ");
|
||||||
scanf("%d",&etage);
|
scanf("%d",&etage);
|
||||||
if (forme=='q')
|
for (tour_etoile=0;tour_etoile<etage;tour_etoile++)
|
||||||
printf("Au revoir ...\n");
|
printf("* ");
|
||||||
else if (forme=='c') {
|
printf("\n");
|
||||||
for (tour_etoile=0;tour_etoile<etage;tour_etoile++){
|
for (hauteur_carre=0;hauteur_carre<(etage-2);hauteur_carre++){
|
||||||
|
printf("* ");
|
||||||
|
for (espace=0;espace<(etage-2);espace++)
|
||||||
|
printf(" ");
|
||||||
printf("* ");
|
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");
|
printf("\n");
|
||||||
nbr_etoile+=2;
|
|
||||||
espace-=2;
|
|
||||||
}
|
}
|
||||||
|
for (tour_etoile=0;tour_etoile<etage;tour_etoile++)
|
||||||
|
printf("* ");
|
||||||
|
printf("\n");
|
||||||
|
} else if (forme=='t') {
|
||||||
|
printf("Donnez un entier pour le nombre d'étage : ");
|
||||||
|
scanf("%d",&etage);
|
||||||
|
for (tour_etage=0;tour_etage<etage;tour_etage++){
|
||||||
|
for (tour_etoile=0;tour_etoile<=tour_etage;tour_etoile++)
|
||||||
|
printf("*");
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
getchar();
|
||||||
|
}while(forme!='q');
|
||||||
|
printf("Au revoir ...\n");
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user