diff --git a/DEV1.1/condition.c b/DEV1.1/condition.c new file mode 100644 index 0000000..b995e0c --- /dev/null +++ b/DEV1.1/condition.c @@ -0,0 +1,50 @@ +# 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"); + } + + printf("%d\n", x); + + return EXIT_SUCCESS; +}*/ + +int main(void){ + int n = 0; + int num = 0; + double x = 0; + int table = 0; + + printf("Entrez un réel : "); + n = scanf("%lf", &x); + num = x ; + table = num % 3; + + if ( table == 2){ + + num = num + 1; + printf("%d \n", num); + }else if(table == 0){ + + printf("%d \n", num); + }else{ + + num = num - 1; + printf("%d \n", num); + } + +} \ No newline at end of file diff --git a/DEV1.1/reels.c b/DEV1.1/reels.c new file mode 100755 index 0000000..5577651 --- /dev/null +++ b/DEV1.1/reels.c @@ -0,0 +1,37 @@ +#include +#include + +/*int main(void) { + printf("%.15f\n", 12345.678910111213); + return EXIT_SUCCESS; +}*/ + +/*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); #pb ici avec % + return EXIT_SUCCESS; +}*/ + +/*int main(void) { # ne foncitone pas car on divise par 0 + printf("%f\n", +1.0/0.0); + printf("%f\n", -1.0/0.0); + printf("%f\n", -0.0/0.0); + return EXIT_SUCCESS; + }*/ + +int main(void) { + int n; + char lettre; + double x; + printf("Entrez un réel : "); + n = scanf("%lf", &x); + printf("son carré vaut : %f\n", x*x); + printf("entrer un caractère : "); + lettre = getchar(); + lettre = getchar(); + printf("j'ai lu : %c\n",lettre); + return EXIT_SUCCESS; +}