From 5428300fc4c66aabd3f0be979bd393cea203ac93 Mon Sep 17 00:00:00 2001 From: meliani~ Date: Tue, 18 Oct 2022 14:49:46 +0200 Subject: [PATCH] =?UTF-8?q?j'ai=20rajout=C3=A9=20tp03?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DEV1.1/TP03/MAIS_NAN.c | 8 ++++++++ DEV1.1/TP03/Triple.c | 18 ++++++++++++++++++ DEV1.1/TP03/anneebissextile.c | 12 ++++++++++++ DEV1.1/TP03/billevesees.c | 23 +++++++++++++++++++++++ DEV1.1/TP03/investissement.c | 20 ++++++++++++++++++++ DEV1.1/TP03/leprint.c | 10 ++++++++++ DEV1.1/TP03/ordrecroissant.c | 29 +++++++++++++++++++++++++++++ DEV1.1/TP03/programme.c | 15 +++++++++++++++ DEV1.1/TP03/signe.c | 18 ++++++++++++++++++ test/oui | 0 10 files changed, 153 insertions(+) create mode 100644 DEV1.1/TP03/MAIS_NAN.c create mode 100644 DEV1.1/TP03/Triple.c create mode 100644 DEV1.1/TP03/anneebissextile.c create mode 100644 DEV1.1/TP03/billevesees.c create mode 100644 DEV1.1/TP03/investissement.c create mode 100644 DEV1.1/TP03/leprint.c create mode 100644 DEV1.1/TP03/ordrecroissant.c create mode 100644 DEV1.1/TP03/programme.c create mode 100644 DEV1.1/TP03/signe.c create mode 100644 test/oui diff --git a/DEV1.1/TP03/MAIS_NAN.c b/DEV1.1/TP03/MAIS_NAN.c new file mode 100644 index 0000000..5e409a6 --- /dev/null +++ b/DEV1.1/TP03/MAIS_NAN.c @@ -0,0 +1,8 @@ +#include +#include +int main(void) { + printf("%f\n", +1.0/0.0); + printf("%f\n", -1.0/0.0); + printf("%f\n", -0.0/0.0); + return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/DEV1.1/TP03/Triple.c b/DEV1.1/TP03/Triple.c new file mode 100644 index 0000000..3c9b4a3 --- /dev/null +++ b/DEV1.1/TP03/Triple.c @@ -0,0 +1,18 @@ +#include +#include +int main(void) { + int x; + scanf("%d",&x); + if (x%3==0) + printf("%d\n" , x); + if (x%3==1) + printf("%d\n", x-1); + if (x%3==2) + printf("%d\n", x+1); + return EXIT_SUCCESS; +} + + + + + \ No newline at end of file diff --git a/DEV1.1/TP03/anneebissextile.c b/DEV1.1/TP03/anneebissextile.c new file mode 100644 index 0000000..e3167de --- /dev/null +++ b/DEV1.1/TP03/anneebissextile.c @@ -0,0 +1,12 @@ +#include +#include +int main(void) { +int annee; +printf("Donnez une année"); +scanf("%d", &annee); +if (annee%4 == 0 && annee%100 != 0) + printf("Année Bissextile"); +if (annee%4 != 0) + printf("Année non bissextile"); +return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/DEV1.1/TP03/billevesees.c b/DEV1.1/TP03/billevesees.c new file mode 100644 index 0000000..b11f4ec --- /dev/null +++ b/DEV1.1/TP03/billevesees.c @@ -0,0 +1,23 @@ +#include +#include +int main(void) { + int x=3; + + if (x=2) + printf("%s", "x vaut 2\n"); + else + printf("%s", "x est different de 2\n"); + + printf("%d", x); + printf("%c", '\n'); + + if (x=0) + printf("%s", "x vaut 0\n"); + else + printf("%s", "x est different de 0\n"); + + printf("%d", x); + printf("%c", '\n'); + + return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/DEV1.1/TP03/investissement.c b/DEV1.1/TP03/investissement.c new file mode 100644 index 0000000..a5e538e --- /dev/null +++ b/DEV1.1/TP03/investissement.c @@ -0,0 +1,20 @@ +#include +#include +int main(void) { + double investi; + scanf("%lf", &investi); + investi = investi * 1.04; + printf("%.4f/n", investi); + investi = investi * 1.04; + printf("%.4f/n", investi); + investi = investi * 1.04; + printf("%.4f/n", investi); + investi = investi * 1.04; + printf("%.4f/n", investi); + investi = investi * 1.04; + printf("%.4f/n", investi); + investi = investi * 1.04; + printf("%.4f/n", investi); + investi = investi * 1.04; + printf("%.4f/n", investi); +} \ No newline at end of file diff --git a/DEV1.1/TP03/leprint.c b/DEV1.1/TP03/leprint.c new file mode 100644 index 0000000..ddca6f1 --- /dev/null +++ b/DEV1.1/TP03/leprint.c @@ -0,0 +1,10 @@ +#include +#include +int main(void) { + printf("%f\n", 5.0+2.5); + printf("%f\n", 5.0-2.5); + printf("%f\n", 5.0*2.5); + printf("%f\n", 5.0/2.5); + printf("%f\n", 5.0%2.5); + return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/DEV1.1/TP03/ordrecroissant.c b/DEV1.1/TP03/ordrecroissant.c new file mode 100644 index 0000000..f105130 --- /dev/null +++ b/DEV1.1/TP03/ordrecroissant.c @@ -0,0 +1,29 @@ +#include +#include +int main(void) { +int val1; +int val2; +int val3; +printf("Donnez une valeur"); +scanf("%d", &val1); +printf("Donnez une valeur"); +scanf("%d", &val2); +printf("Donnez une valeur"); +scanf("%d", &val3); +if (val1 > val2 && val2 > val3 && val1 > val3) + printf("%d %d %d\n", val3, val2, val1); +if (val3 > val2 && val2 > val1 && val3 > val1); + printf("%d %d %d\n", val1, val2, val3); +if (val2 > val1 && val1 > val3 && val2 > val3); + printf("%d %d %d\n", val3, val1, val2); +if (val1 > val3 && val3 > val2 && val1 > val2); + printf("%d %d %d\n", val2, val3, val1); +if (val3 > val1 && val1 > val2 && val3 > val2); + printf("%d %d %d\n", val2, val1, val3); +if (val2 > val3 && val3 > val1 && val2 > val1); + printf("%d %d %d\n", val1, val3, val2); +return EXIT_SUCCESS; +} + + + diff --git a/DEV1.1/TP03/programme.c b/DEV1.1/TP03/programme.c new file mode 100644 index 0000000..982049c --- /dev/null +++ b/DEV1.1/TP03/programme.c @@ -0,0 +1,15 @@ +#include +#include +int main(void) { + int virgule; + char message; + scanf("%lf", &virgule); + printf("%e\n", virgule); + scanf(" %c", &message); + printf("%c\n", message); + printf("%c\n", message); + printf("%c\n", message); + printf("%c\n", message); + printf("%c\n", message); + return EXIT_SUCCESS; +} diff --git a/DEV1.1/TP03/signe.c b/DEV1.1/TP03/signe.c new file mode 100644 index 0000000..82cb191 --- /dev/null +++ b/DEV1.1/TP03/signe.c @@ -0,0 +1,18 @@ +#include +#include +int main(void) { + int x; + int y; + printf("donne x"); + scanf("%d",&x); + printf("donne y"); + scanf("%d",&y); + if (x<0 || y<0) + printf("c'est négatif"); + if (x>0 && y>0) + printf("c'est positif"); + return EXIT_SUCCESS; +} + + + \ No newline at end of file diff --git a/test/oui b/test/oui new file mode 100644 index 0000000..e69de29