diff --git a/DEV1.1/TP06/Exo2.c b/DEV1.1/TP06/Exo2.c index bcc3e8a..0cda157 100644 --- a/DEV1.1/TP06/Exo2.c +++ b/DEV1.1/TP06/Exo2.c @@ -3,11 +3,11 @@ int main(void) { int x; - printf("entrez un nombre entier"); + printf("entrez un nombre entier\n"); x = scanf("%d",&x); if (x>0) { - printf("%d\n", x*3); + printf("%d\n", x%3*3); } return EXIT_SUCCESS; diff --git a/DEV1.1/TP06/réponses.txt b/DEV1.1/TP06/réponses.txt index e69de29..edc8027 100644 --- a/DEV1.1/TP06/réponses.txt +++ b/DEV1.1/TP06/réponses.txt @@ -0,0 +1,12 @@ +1) +on a une op conditionnelle où si x = 2 on printf "x vaut 2" ou sinn il +différent de 2 +x = 2 donc on printf "x vaut 2". + +on a un 2e printf sans condition où on print x + +autre op condit ou si x=0 on print x vaut 0 ou sinn il est +différent de 0 +x = 3 donc on print le else + +on print une dernière fois x \ No newline at end of file diff --git a/DEV1.1/TP07/.nfs00000000062b30c30000004b b/DEV1.1/TP07/.nfs00000000062b30c30000004b new file mode 100755 index 0000000..f65687e Binary files /dev/null and b/DEV1.1/TP07/.nfs00000000062b30c30000004b differ diff --git a/DEV1.1/TP07/exo1.c b/DEV1.1/TP07/exo1.c new file mode 100644 index 0000000..14d5ac2 --- /dev/null +++ b/DEV1.1/TP07/exo1.c @@ -0,0 +1,24 @@ +#include +#include + +int main(void) { + int n, i, x; + + printf("entrez un réel :\n"); + n = scanf("%d", &n); + printf("%d", n); + + printf("entrez un réel :\n"); + i = scanf("%d", &i); + printf("%d", i); + + + x = n; + if (x >= n); { + while (x < i) { + printf("%d", x); + x = x + 1; + } +} + return EXIT_SUCCESS; +} \ No newline at end of file