tp
This commit is contained in:
parent
367f0384d6
commit
ab149abb2d
BIN
Dev1.1/Dev2809/Devinette
Executable file
BIN
Dev1.1/Dev2809/Devinette
Executable file
Binary file not shown.
34
Dev1.1/Dev2809/Devinette.c
Normal file
34
Dev1.1/Dev2809/Devinette.c
Normal file
@ -0,0 +1,34 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(void) {
|
||||
|
||||
int i;
|
||||
int chiffre = 0;
|
||||
srand(time(NULL));
|
||||
int var = rand()%100+1 ;
|
||||
for(i= 0; i < 5; i++){
|
||||
printf("rentrez un entier :");
|
||||
scanf("%d", &chiffre);
|
||||
if (chiffre == var) {
|
||||
printf("c'est le bon chiffre Bravo !\n");
|
||||
return EXIT_SUCCESS; }
|
||||
if (chiffre > var) {
|
||||
printf("-\n");
|
||||
}else{
|
||||
if (chiffre < var ) {
|
||||
printf("+\n");}
|
||||
}
|
||||
}
|
||||
printf("Le chiffre était : %d\n",var);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
12
Dev1.1/Dev2809/Figures.c
Normal file
12
Dev1.1/Dev2809/Figures.c
Normal file
@ -0,0 +1,12 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(void){
|
||||
int i;
|
||||
int premier;
|
||||
int add;
|
||||
printf("Entrez un nombre premier :");
|
||||
scanf("%d", &premier);
|
||||
for (i=0;i<premier-1;i++) {
|
||||
|
||||
|
BIN
Dev1.1/Dev2809/Premier
Executable file
BIN
Dev1.1/Dev2809/Premier
Executable file
Binary file not shown.
27
Dev1.1/Dev2809/Premier.C
Normal file
27
Dev1.1/Dev2809/Premier.C
Normal file
@ -0,0 +1,27 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(void) {
|
||||
|
||||
int i;
|
||||
int chiffre = 0;
|
||||
printf("rentrez un entier naturel :");
|
||||
scanf("%d", &chiffre);
|
||||
if (chiffre == 0) {
|
||||
printf("Erreur Chiffre nul \n");
|
||||
}
|
||||
if (chiffre == 2 || chiffre == 1) {
|
||||
printf("C'est un chiffre premier\n");
|
||||
}
|
||||
for (i = 2; i < chiffre;i++) {
|
||||
if (chiffre % i == 0) {
|
||||
printf("Ce n'est pas un nombre premier\n");
|
||||
return EXIT_SUCCESS;
|
||||
}else{
|
||||
printf("C'est un nombre premier\n");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
25
Dev1.1/Dev2809/Progression.c
Normal file
25
Dev1.1/Dev2809/Progression.c
Normal file
@ -0,0 +1,25 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(void) {
|
||||
int i;
|
||||
int terme;
|
||||
int resultat;
|
||||
int nbr1 = 0;
|
||||
int nbr2 = 1;
|
||||
printf("Quel terme voulez vous ? :");
|
||||
scanf("%d",&terme);
|
||||
for (i = 0; i <terme+1;i++) {
|
||||
if (i <= 1)
|
||||
resultat = i;
|
||||
else
|
||||
{ resultat = nbr1 + nbr2;
|
||||
nbr1 = nbr2;
|
||||
nbr2 = resultat;}
|
||||
}
|
||||
printf("%d\n", resultat);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
BIN
Dev1.1/Dev2809/TableMultiplication
Executable file
BIN
Dev1.1/Dev2809/TableMultiplication
Executable file
Binary file not shown.
29
Dev1.1/Dev2809/TableMultiplication.c
Normal file
29
Dev1.1/Dev2809/TableMultiplication.c
Normal file
@ -0,0 +1,29 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#define TAILLE 11
|
||||
|
||||
int main(void) {
|
||||
int i;
|
||||
int y;
|
||||
printf(" X |");
|
||||
for ( i = 0; i < TAILLE+1;i++){
|
||||
printf("%3d ",i);
|
||||
}
|
||||
printf("\n");
|
||||
printf("-----+");
|
||||
for (i = 0;i< TAILLE+1;i++){
|
||||
printf("-----");
|
||||
}
|
||||
printf("\n");
|
||||
for ( i = 0;i<TAILLE+1;i++){
|
||||
printf("%3d ",i);
|
||||
printf("|");
|
||||
for (y = 0; y<TAILLE+1;y++){
|
||||
printf("%3d ",i*y);}
|
||||
printf("\n");
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
|
BIN
Dev1.1/Dev2809/progression
Executable file
BIN
Dev1.1/Dev2809/progression
Executable file
Binary file not shown.
Loading…
Reference in New Issue
Block a user