diff --git a/DEV1.1/TP05/borne.c b/DEV1.1/TP05/borne.c new file mode 100644 index 0000000..2cab0e7 --- /dev/null +++ b/DEV1.1/TP05/borne.c @@ -0,0 +1,22 @@ +#include +#include + +int main(void){ + int x = 0; + int y = 0; + int i; + printf("Rentrer un entier: "); + scanf("%d",&x); + y = x; + while(x!=(-1)){ + if(x +#include + +int main(void){ + int x = 0; + int i; + printf("Rentrer un entier sur lequel baser la table (-1 pour arretez): "); + scanf("%d",&x); + while(x!=(-1)){ + for(i = 1;i<11;i++) { + printf("%d x %d = %d \n",x,i,x*i); + } + printf("Rentrer un entier sur lequel baser la table (-1 pour arretez): "); + scanf("%d",&x); + } + return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/DEV1.1/TP06/compte.c b/DEV1.1/TP06/compte.c new file mode 100644 index 0000000..0aebccb --- /dev/null +++ b/DEV1.1/TP06/compte.c @@ -0,0 +1,28 @@ +#include +#include + +int main(void){ + char x; + int i = 0; + int j = 0; + int k = 0; + char y; + printf("Rentrer du texte:"); + x = getchar(); + while(1){ + + if(x == '\n'){ + j++; + } + else{ + if(x>='a'&&x<='z'&&x>='A'&&x<='Z'){ + y=x; + } + } + + x = getchar() + } + + printf("saut a la ligne: %d \nnombre de charactere") + return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/DEV1.1/TP06/disque.c b/DEV1.1/TP06/disque.c new file mode 100644 index 0000000..00ffa10 --- /dev/null +++ b/DEV1.1/TP06/disque.c @@ -0,0 +1,24 @@ +#include +#include + +int main(void){ + int h = 0; + int x; + int y; + printf("Rentrer le rayon: "); + scanf("%d",&h); + for(x=-(h);x +#include + +int main(void){ + int x = 0; + int i; + int j; + printf("Rentrer un entier: "); + scanf("%d",&x); + printf("%d = ",x); + while(x!=0){ + for(j = 2;j +#include + +int main(void){ + int x = 0; + int i; + int j; + int k; + int l; + printf("Rentrer un entier:"); + scanf("%d",&x); + for(i=-1;(i*i)>=x;i++){ + for(j=-1;(j*j)>=x;i++){ + for(k=-1;(k*k)>=x;i++){ + for(l=-1;(l*l)>=x;i++){ + if(i*i+j*j+k*k+l*l==x){ + printf("%d=%d+%d+%d+%d",x,i*i,j*j,k*k,l*l); + } + } + } + } + } + + + return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/DEV1.1/TP06/maximum.c b/DEV1.1/TP06/maximum.c new file mode 100644 index 0000000..246456e --- /dev/null +++ b/DEV1.1/TP06/maximum.c @@ -0,0 +1,56 @@ +#include +#include +#include +int main(void){ + srand(time(0)); + int tab[10]; + int i; + for(i=0;i<10;i++){ + tab[i]=(rand()%(50+1-(-50)))-50; + } + int indice; + int max=tab[0]; + for(i=1;i<10;i++){ + if(max +#include +#include +int main(void){ + srand(time(0)); + int tab[10]; + int i; + for(i=0;i<10;i++){ + tab[i]=(rand()%(50+1-(-50)))-50; + } + for(i=0;i<10;i++){ + printf("%d, ",tab[i]); + } + printf("\n"); + + int tabM[10]; + for(i=0;i<10;i++){ + tabM[i] = tab[9-i]; + } + + for(i=0;i<10;i++){ + printf("%d, ",tabM[i]); + } + + return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/DEV1.1/TP06/recherche.c b/DEV1.1/TP06/recherche.c new file mode 100644 index 0000000..89728ca --- /dev/null +++ b/DEV1.1/TP06/recherche.c @@ -0,0 +1,27 @@ +#include +#include +#include +int main(void){ + srand(time(0)); + int tab[10]; + int i; + for(i=0;i<10;i++){ + tab[i]=(rand()%(50+1-(-50)))-50; + } + for(i=0;i<10;i++){ + printf("%d, ",tab[i]); + } + + int look; + printf("\n Rentrez un nombre,\n si le nombre se trouve dans le tableau son indice sera affiché \n (le cas écheant -1 sera affiché):"); + scanf("%d",&look); + int indice; + for(i=0;i<10;i++){ + if(tab[i]==look){ + indice=i; + } + } + printf("indice : %d \n", indice); + + return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/DEV1.1/TP06/remplissage.c b/DEV1.1/TP06/remplissage.c new file mode 100644 index 0000000..cede1be --- /dev/null +++ b/DEV1.1/TP06/remplissage.c @@ -0,0 +1,27 @@ +#include +#include +#include +int main(void){ + srand(time(0)); + int tab[10]; + int i; + for(i=0;i<10;i++){ + tab[i]=(rand()%(50+1-(-50)))-50; + } + + printf("+"); + for(i=0;i<10;i++){ + printf("-----+"); + } + printf("\n"); + for(i=0;i<10;i++){ + printf("|%3d, ",tab[i]); + } + + printf("|\n+"); + for(i=0;i<10;i++){ + printf("-----+"); + } + printf("\n"); + return EXIT_SUCCESS; +} \ No newline at end of file