11 Octobre
This commit is contained in:
parent
8f64f6143a
commit
965589da20
BIN
DEV1.1/TP05:Boucles/Boucles:suite/Boucles:encore/.nfs00000000008c1c9600000051
Executable file
BIN
DEV1.1/TP05:Boucles/Boucles:suite/Boucles:encore/.nfs00000000008c1c9600000051
Executable file
Binary file not shown.
10
DEV1.1/TP05:Boucles/Boucles:suite/Boucles:encore/disque.c
Normal file
10
DEV1.1/TP05:Boucles/Boucles:suite/Boucles:encore/disque.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main() {
|
||||
int r;
|
||||
printf("Veuillez saisir un rayon : ");
|
||||
scanf("%d"&r);
|
||||
|
||||
return 0;
|
||||
}
|
29
DEV1.1/TP05:Boucles/Boucles:suite/Boucles:encore/diviseur.c
Normal file
29
DEV1.1/TP05:Boucles/Boucles:suite/Boucles:encore/diviseur.c
Normal file
@ -0,0 +1,29 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main() {
|
||||
int a;
|
||||
int b;
|
||||
int c;
|
||||
int d;
|
||||
int e;
|
||||
printf("Veuillez saisir 2 entiers naturels : ");
|
||||
scanf("%d",&a);
|
||||
scanf(" %d",&b);
|
||||
if (b>a){
|
||||
c=a;
|
||||
a=b;
|
||||
b=c;
|
||||
}if(b==0){
|
||||
printf("Le pgcd entre %d et %d est de %d\n",a,b,a);
|
||||
}else{
|
||||
d=a;
|
||||
e=b;
|
||||
while(d!=0&&e!=0){
|
||||
c=d;
|
||||
d=e;
|
||||
e=c%e;
|
||||
} printf("Le pgcd entre %d et %d est de %d\n",a,b,d);
|
||||
}
|
||||
return 0;
|
||||
}
|
@ -20,6 +20,29 @@ int main() {
|
||||
printf("*");
|
||||
} printf("\n");
|
||||
}
|
||||
} else{
|
||||
if (n=='c'){
|
||||
printf("Hauteur ? ");
|
||||
scanf("%d",&h);
|
||||
for (i=1;i<=h;i++){
|
||||
for (j=1;j<=h;j++){
|
||||
if (j==1||j==h){
|
||||
printf("* ");
|
||||
} else{
|
||||
if (i==1||i==h){
|
||||
printf("* ");
|
||||
}else{
|
||||
printf(" ");
|
||||
}
|
||||
}
|
||||
}printf("\n");
|
||||
}
|
||||
}else{
|
||||
if(n=='q'){
|
||||
printf("Au revoir...\n\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user