Skip to content

Instantly share code, notes, and snippets.

@Ambratolm
Created June 25, 2017 12:59
Show Gist options
  • Save Ambratolm/0b8c0b235995ceb765dea53d3b5eb1af to your computer and use it in GitHub Desktop.
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.
#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");
}
@Maounde
Copy link

Maounde commented Oct 29, 2021

10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment