Created
June 25, 2017 12:59
-
-
Save Ambratolm/0b8c0b235995ceb765dea53d3b5eb1af to your computer and use it in GitHub Desktop.
Un magasin de reprographie facture 0,10 DH les dix premières photocopies, 0,09 DH les vingt suivantes et 0,08 DH au-delà. Ecrivez un algorithme qui demande à l’utilisateur le nombre de photocopies effectuées et qui lui affiche la facture correspondante.
This file contains hidden or 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
#include<stdio.h> | |
main() | |
{ | |
printf("*********************************************\n"); | |
printf("Facture de photocopies\n"); | |
printf("*********************************************\n"); | |
int n ; | |
float p ; | |
printf("\nEntrez le nombre de photocopies effectueess: "); | |
scanf("%d", &n); | |
printf("_____________________________________________\n"); | |
if (n <= 10) { | |
p = n*0.10 ; | |
printf("\nFacture: %.2f DH", p); | |
} else if (n <= 20) { | |
n = n-10 ; | |
p = n*0.09 ; | |
p = p + 0.10*10 ; | |
printf("\nFacture: %.2f DH", p); | |
} else { | |
n = n-20 ; | |
p = n*0.08 ; | |
p = p + 0.09*20 ; | |
printf("\nFacture: %.2f DH", p); | |
} | |
printf("\n*********************************************\n"); | |
system("pause"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
10