Compare commits
4 Commits
695024c025
...
main
Author | SHA1 | Date | |
---|---|---|---|
1967fb5e22 | |||
3f14e4bcbd | |||
|
c58a81f6d6 | ||
|
8b82af958b |
1
DEV1.1/DEV
Submodule
1
DEV1.1/DEV
Submodule
Submodule DEV1.1/DEV added at 2946df4c38
29
DEV1.1/TP05/tp5.c
Normal file
29
DEV1.1/TP05/tp5.c
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
/*EXO
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
int n;
|
||||||
|
double x;
|
||||||
|
char v;
|
||||||
|
printf("Saisir un réel");
|
||||||
|
n = scanf("%lf\n",&x);
|
||||||
|
v = getchar();
|
||||||
|
printf("Sa forme scientifque : %e\n",n);
|
||||||
|
printf("5 fois de suites ; %c,%c,%c,%c,%c",v);
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
int main(void){
|
||||||
|
int epargne;
|
||||||
|
double x;
|
||||||
|
printf("Combien veux-tu investir : ");
|
||||||
|
epargne = scanf("%lf",&x);
|
||||||
|
printf("après 1 an : %9.4f\n",epargne + 0.04);
|
||||||
|
printf("après 2 ans: %9.4f\n",epargne + (0.04*2));
|
||||||
|
printf("après 3 ans: %9.4f\n",epargne + (0.04*3));
|
||||||
|
printf("après 4 ans: %9.4f\n",epargne + (0.04*4));
|
||||||
|
printf("après 5 ans: %9.4f\n",epargne + (0.04*5));
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
27
DEV1.1/TP06/exo1.c
Normal file
27
DEV1.1/TP06/exo1.c
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
int x=3;
|
||||||
|
|
||||||
|
if (x=2) {
|
||||||
|
printf("x vaut 2\n");
|
||||||
|
} else {
|
||||||
|
printf("x est different de 2\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("%d\n", x);
|
||||||
|
|
||||||
|
if (x=0) {
|
||||||
|
printf("x vaut 0\n");
|
||||||
|
} else {
|
||||||
|
printf("x est different de 0\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* il se passe que lors du premier if x vaut 2 donc le programme prinf: x vaut 2
|
||||||
|
et dans le second if x=0 ce qui vaut faut donc le programme print: x different de 0*/
|
||||||
|
|
||||||
|
printf("%d\n", x);
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
18
DEV1.1/TP06/exo2.c
Normal file
18
DEV1.1/TP06/exo2.c
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
int main(void){
|
||||||
|
int n;
|
||||||
|
int err;
|
||||||
|
|
||||||
|
printf("Entrer un entier naturel ");
|
||||||
|
err= scanf("%d",&n);
|
||||||
|
if ((n%3)<=1) {
|
||||||
|
printf("le multiple le plus proche est : %d\n", (n /3)*3);
|
||||||
|
} else {
|
||||||
|
printf("%d\n",(n/3+1)*3);
|
||||||
|
}
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
25
DEV1.1/TP06/exo3.c
Normal file
25
DEV1.1/TP06/exo3.c
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
int r1;
|
||||||
|
int r2;
|
||||||
|
int err1;
|
||||||
|
int err2;
|
||||||
|
|
||||||
|
printf("Saisir le premier réel :\n");
|
||||||
|
err1 = scanf("%d",&r1);
|
||||||
|
|
||||||
|
printf("Saisir le second réel :\n");
|
||||||
|
err2 = scanf("%d",&r2);
|
||||||
|
|
||||||
|
if ((r1 > -1 && r2 > -1) || (r1 <0 && r2 <0)){
|
||||||
|
|
||||||
|
/* si (R1>-1) ET (R2>-1) est vrai alors + sinon - OU (R1<0) et (R2<0) est vrai alors + sinon -.Si aucune des deux conditions est vrai alors ca renvoie */
|
||||||
|
|
||||||
|
printf("le signe du produit est +\n");
|
||||||
|
} else {
|
||||||
|
printf("le signe du produit est -\n");
|
||||||
|
}
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
45
DEV1.1/TP06/exo4.c
Normal file
45
DEV1.1/TP06/exo4.c
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
|
||||||
|
int v1;
|
||||||
|
int v2;
|
||||||
|
int v3;
|
||||||
|
|
||||||
|
int r1;
|
||||||
|
int r2;
|
||||||
|
int r3;
|
||||||
|
int es;
|
||||||
|
|
||||||
|
printf("Saisir la premier entier naturel :\n");
|
||||||
|
v1 = scanf("%d",&r1);
|
||||||
|
|
||||||
|
printf("Saisir le second entier naturel :\n");
|
||||||
|
v2 = scanf("%d",&r2);
|
||||||
|
|
||||||
|
printf("Saisir le troisième entier naturel :\n");
|
||||||
|
v3 = scanf("%d",&r3);
|
||||||
|
|
||||||
|
|
||||||
|
if (r1<r2){
|
||||||
|
printf("%d",r1);
|
||||||
|
} else{
|
||||||
|
printf("%d",r2);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (r2<r3){
|
||||||
|
printf("%d",r2);
|
||||||
|
} else{
|
||||||
|
printf("%d",r3);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (r3==r3){
|
||||||
|
printf("%d",r3);
|
||||||
|
} else{
|
||||||
|
printf("%d",r1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
Reference in New Issue
Block a user