-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 1fdf886
Showing
3 changed files
with
100 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/****************************************************************************** | ||
TD Informatique | ||
Aloïs GAUCHER | ||
*******************************************************************************/ | ||
|
||
#include <stdio.h> | ||
|
||
int a,b,c; | ||
|
||
int main() | ||
{ | ||
printf("Saisissez le premier nombre à additionner \n"); | ||
scanf("%d" ,&a); | ||
printf("Saisissez le second nombre à additionner \n"); | ||
scanf("%d" ,&b); | ||
c = a + b; | ||
printf("Le résultat de l'opération est %d \n", c); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/****************************************************************************** | ||
TD Informatique | ||
Aloïs GAUCHER | ||
*******************************************************************************/ | ||
|
||
#include <stdio.h> | ||
|
||
float a,b,c = 0; | ||
int selection; | ||
|
||
int main() | ||
{ | ||
|
||
//Saisie des opérandes | ||
printf("Saisissez le premier nombre: \n"); | ||
scanf("%f" ,&a); | ||
printf("Saisissez le second nombre: \n"); | ||
scanf("%f" ,&b); | ||
|
||
printf("Veuillez choisir l'opération à réaliser: \n"); | ||
printf("1 - Multiplication\n"); | ||
printf("2 - Addition\n"); | ||
printf("3 - Soustraction\n"); | ||
printf("4 - Division\n"); | ||
scanf("%d" ,&selection); | ||
switch(selection) | ||
{ | ||
case 1: | ||
c = a * b; | ||
break; | ||
case 2: | ||
c = a + b; | ||
break; | ||
case 3: | ||
c = a - b; | ||
break; | ||
case 4: | ||
c = a / b; | ||
break; | ||
default: | ||
printf("Veuillez choisir une opération à réaliser (1 - 4) !\n"); | ||
} | ||
|
||
//Résultat | ||
printf("Le résultat de l'opération est %f", c); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/****************************************************************************** | ||
TD Informatique | ||
Aloïs GAUCHER | ||
*******************************************************************************/ | ||
|
||
#include <stdio.h> | ||
|
||
int prix, somme, total; | ||
|
||
int main() | ||
{ | ||
do { | ||
printf("Prix de l'article: \n"); | ||
scanf("%d", &prix); | ||
somme += prix; | ||
} while ( prix != (0) ); // Condition de sortie de la boucle 0 | ||
if ( somme < 99 ) { | ||
total = somme; | ||
} | ||
else if ( somme >= 100 && somme <= 499 ) { // 10% de réduction | ||
total = somme * 0.90; | ||
} | ||
else if ( somme >= 500 && somme <= 999 ) { // 20% de réduction | ||
total = somme * 0.80; | ||
} | ||
else if ( somme > 999 ) { // 30% de réduction | ||
total = somme * 0.70; | ||
} | ||
|
||
printf("Le montant des articles est: %d€ \n", total); | ||
|
||
return 0; | ||
} |