diff --git a/DEV1.1/TP05/devinette.c b/DEV1.1/TP05/devinette.c new file mode 100644 index 0000000..0cb1093 --- /dev/null +++ b/DEV1.1/TP05/devinette.c @@ -0,0 +1,31 @@ +#include +#include +#include +int main(void){ + srand(time(0)); + int x = (rand()%(100-0+1))+0; + int y = 0; + int i; + for(i=0;i<5;i++) { + printf("renter un chiffre entre 0 et 100:"); + scanf("%d",&y); + if (y==x){ + i=5; + printf("Bon nombre"); + } + else{ + if(y +#include + +int main(void){ + int x; + int y; + int temp; + printf("Rentrer deux entier: "); + scanf("%d %d",&x,&y); + while(y!=0){ + temp=y; + y=x%y; + x=temp; + } + printf("%d",x); + return EXIT_SUCCESS; +} + + diff --git a/DEV1.1/TP05/division.c b/DEV1.1/TP05/division.c new file mode 100644 index 0000000..9b97e27 --- /dev/null +++ b/DEV1.1/TP05/division.c @@ -0,0 +1,18 @@ +#include +#include + +int main(void){ + int x = 0; + int y = 0; + int z = 0; + printf("Rentrer un entier >= 0: "); + scanf("%d",&x); + printf("Rentrer un entier > 0: "); + scanf("%d",&y); + while (x > y) { + z++; + x=x-y; + } + printf("%d = %d x %d + %d",((y*z)+x),y,z,x); + return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/DEV1.1/TP05/fibbo.c b/DEV1.1/TP05/fibbo.c new file mode 100644 index 0000000..ef949ce --- /dev/null +++ b/DEV1.1/TP05/fibbo.c @@ -0,0 +1,19 @@ +#include +#include + +int main(void){ + int x = 0; + int i; + int y = 0; + int j = 1; + int temp; + printf("Rentrer un entier: "); + scanf("%d",&x); + for(i=1;i<=x;i++){ + temp = y+j; + y=j; + j=temp; + } + printf("le %d terme de fibonacci est %d",x,y); + return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/DEV1.1/TP05/figures.c b/DEV1.1/TP05/figures.c new file mode 100644 index 0000000..2f25a3f --- /dev/null +++ b/DEV1.1/TP05/figures.c @@ -0,0 +1,52 @@ +#include +#include + +int main(void){ + char x; + int y; + int i; + int j; + int maxj=1; + printf("____________\n t) triangle\n c) Carre\nq) Quitter\nVotre choix ? :"); + scanf("%c",&x); + if(x=='t'){ + printf("Hauteur ?: "); + getchar(); + scanf("%d",&y); + for(i=1;i<=y;i++){ + for(j=1;j<=maxj;j++){ + printf("*"); + } + printf("\n"); + maxj+=1; + } + } + else{ + if(x=='c'){ + printf("Hauteur ?: "); + getchar(); + scanf("%d",&y); + for(i=1;i<=y;i++){ + if((i==1)||(i==y)){ + for(j=1;j<=y;j++){ + printf("*"); + } + } + else{ + printf("*"); + for(j=1;j +#include + +int main(void){ + int x = 0; + int i; + int j; + printf("Rentrer un entier: "); + scanf("%d",&x); + printf("X |"); + for (i=0;i +#include + +int main(void){ + int x = 0; + int i; + printf("Rentrer un entier: "); + scanf("%d",&x); + for(i = 1;i +#include + +int main(void){ + int x; + int i; + int j; + int maxj=1; + int maxj2=x/2-1; + + printf("Hauteur ?: "); + scanf("%d",&x); + for(i=1;i +#include + +int main(void){ + int x = 0; + int i; + printf("Rentrer un entier: "); + scanf("%d",&x); + for(i = 1;i<11;i++) { + printf("%d x %d = %d \n",x,i,x*i); + } + return EXIT_SUCCESS; +} \ No newline at end of file