This commit is contained in:
2023-10-23 13:23:36 +02:00
parent 667dae6f1a
commit 322b22f9bf
5711 changed files with 72953 additions and 0 deletions

BIN
DEV/DEV1.1/TP_Boucles2/exe Executable file

Binary file not shown.

View File

@@ -0,0 +1,29 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(void) {
int nombreMystere;
int chiffreSaisis;
int i;
srand(time(NULL));
nombreMystere =(rand()%100)+1;
for (i=0;i<5;i+=1){
printf("Deviner mon nombre : ");
scanf("%d", &chiffreSaisis);
if (chiffreSaisis > nombreMystere){
printf("C'est moins !\n");
}
if (chiffreSaisis < nombreMystere){
printf("C'est plus !\n");
}
if (chiffreSaisis == nombreMystere){
printf("Bravo !!! c'était bien ");
printf("%d", nombreMystere);
return EXIT_SUCCESS;
}
}
printf("Perdu ! vos 5 tentatives n'ont pas suffit à trouver que j'avais choisis ");
printf("%d\n", nombreMystere);
return EXIT_SUCCESS;
}

View File

View File

@@ -0,0 +1,21 @@
#include <stdio.h>
#include <stdlib.h>
int main(void) {
int chiffreSaisis;
int diviseur;
printf("Saisissez un entier : ");
scanf("%d", &chiffreSaisis);
for(diviseur=chiffreSaisis-1;diviseur>1;diviseur-=1){
if (chiffreSaisis%diviseur==0){
printf("Ce nombre n'est pas premier\n");
return EXIT_SUCCESS;
}
}
if (chiffreSaisis==1){
printf("Ce nombre n'est pas premier\n");
return EXIT_SUCCESS;
}
printf("Ce nombre est premier\n");
return EXIT_SUCCESS;
}

View File

View File

@@ -0,0 +1,40 @@
#include <stdio.h>
#include <stdlib.h>
int main(void) {
int taille;
int x;
printf("Saisissez la taille de la table de multiplication que vous souhaitez : ");
scanf("%d", &taille);
for (x=-2; x<=taille; x+=1){
int y;
printf("\n");
for (y=-2; y<=taille; y+=1){
if (x==-2){
if (y==-2){
printf(" X ");}
if (y==-1){
printf(" | ");}
if (y>=0){
printf("%3d", y);}
}
if (x==-1){
if (y==-2){
printf("---");}
if (y==-1){
printf("-+-");}
if (y>=0){
printf("---");}
}
if (x >= 0){
if (y==-2){
printf("%3d",x);}
if (y==-1){
printf(" | ");}
if (y>=0){
printf("%3d",x*y);}
}
}
}
return EXIT_SUCCESS;
}

View File

View File

@@ -0,0 +1,26 @@
#include <stdio.h>
#include <stdlib.h>
int main(void) {
int i;
int n0=0;
int n1=1;
int n;
printf("Saisissez un entier : ");
scanf("%d", &n);
for(i=0;i<n;i+=1){
if (i%2==0){
n0=n0+n1;
} else{
n1=n0+n1;
}
}
if (n%2==0) {
printf("%d\n",n0);
} else{
printf("%d\n",n1);
}
return EXIT_SUCCESS;
}

View File

View File

@@ -0,0 +1,26 @@
#include <stdio.h>
#include <stdlib.h>
int main(void) {
int i;
int n0=0;
int n1=1;
int n;
printf("Saisissez un entier : ");
scanf("%d", &n);
for(i=0;i<n;i+=1){
if (i%2==0){
n0=n0+n1;
} else{
n1=n0+n1;
}
}
if (n%2==0) {
printf("%d\n",n0);
} else{
printf("%d\n",n1);
}
return EXIT_SUCCESS;
}