j'ai rajouté tp03

This commit is contained in:
Menouer MELIANI 2022-10-18 14:49:46 +02:00
parent cd581d4b26
commit 5428300fc4
10 changed files with 153 additions and 0 deletions

8
DEV1.1/TP03/MAIS_NAN.c Normal file
View File

@ -0,0 +1,8 @@
#include <stdio.h>
#include <stdlib.h>
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;
}

18
DEV1.1/TP03/Triple.c Normal file
View File

@ -0,0 +1,18 @@
#include <stdio.h>
#include <stdlib.h>
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;
}

View File

@ -0,0 +1,12 @@
#include <stdio.h>
#include <stdlib.h>
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;
}

23
DEV1.1/TP03/billevesees.c Normal file
View File

@ -0,0 +1,23 @@
#include <stdio.h>
#include <stdlib.h>
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;
}

View File

@ -0,0 +1,20 @@
#include <stdio.h>
#include <stdlib.h>
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);
}

10
DEV1.1/TP03/leprint.c Normal file
View File

@ -0,0 +1,10 @@
#include <stdio.h>
#include <stdlib.h>
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;
}

View File

@ -0,0 +1,29 @@
#include <stdio.h>
#include <stdlib.h>
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;
}

15
DEV1.1/TP03/programme.c Normal file
View File

@ -0,0 +1,15 @@
#include <stdio.h>
#include <stdlib.h>
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;
}

18
DEV1.1/TP03/signe.c Normal file
View File

@ -0,0 +1,18 @@
#include <stdio.h>
#include <stdlib.h>
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;
}

0
test/oui Normal file
View File