From 8b82af958bc63756bc4a72e675f7bc79dadae534 Mon Sep 17 00:00:00 2001 From: Adrien Jackson--Gonzalez Date: Tue, 16 Sep 2025 15:53:59 +0200 Subject: [PATCH] fin TP --- DEV1.1/DEV | 1 + DEV1.1/TP05/tp5.c | 20 ++++++++++++++++---- DEV1.1/TP06/exo1.c | 27 +++++++++++++++++++++++++++ DEV1.1/TP06/exo2.c | 18 ++++++++++++++++++ 4 files changed, 62 insertions(+), 4 deletions(-) create mode 160000 DEV1.1/DEV create mode 100644 DEV1.1/TP06/exo1.c create mode 100644 DEV1.1/TP06/exo2.c diff --git a/DEV1.1/DEV b/DEV1.1/DEV new file mode 160000 index 0000000..2946df4 --- /dev/null +++ b/DEV1.1/DEV @@ -0,0 +1 @@ +Subproject commit 2946df4c38baf84a9a5028c4fb3101a49e6fbd90 diff --git a/DEV1.1/TP05/tp5.c b/DEV1.1/TP05/tp5.c index 450857f..57ce3a6 100644 --- a/DEV1.1/TP05/tp5.c +++ b/DEV1.1/TP05/tp5.c @@ -1,7 +1,7 @@ #include #include -/*EXO 1*/ +/*EXO int main(void) { int n; @@ -9,9 +9,21 @@ int main(void) { char v; printf("Saisir un réel"); n = scanf("%lf\n",&x); - printf("Sa forme scientifque : %e\n",n), v = getchar(); + printf("Sa forme scientifque : %e\n",n); printf("5 fois de suites ; %c,%c,%c,%c,%c",v); - return EXIT_SUCCESS; -} +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; +} diff --git a/DEV1.1/TP06/exo1.c b/DEV1.1/TP06/exo1.c new file mode 100644 index 0000000..aca0f3b --- /dev/null +++ b/DEV1.1/TP06/exo1.c @@ -0,0 +1,27 @@ +#include +#include + +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; +} \ No newline at end of file diff --git a/DEV1.1/TP06/exo2.c b/DEV1.1/TP06/exo2.c new file mode 100644 index 0000000..961c553 --- /dev/null +++ b/DEV1.1/TP06/exo2.c @@ -0,0 +1,18 @@ +#include +#include + +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; + } + + \ No newline at end of file