Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. #include <stdio.h>
  2. #define ff 500
  3. int main()
  4. {
  5.  
  6. float PP = 0;
  7. int c;
  8.  
  9. do
  10. {
  11. printf("Donner la consommation en KWH : ");
  12. scanf("%d",&c);
  13. } while (c<=0);
  14.  
  15.  
  16. if (c<=100)
  17. {
  18. PP = c*70 + ff;
  19. }
  20. else if (c>100 && c<=250)
  21. {
  22. PP = 100*70 + (c-100)*85 + ff;
  23. }
  24. else
  25. {
  26. PP = 100*70 + 150*85 + (c-150)*95 + ff;
  27. }
  28. printf("Le montant à payer est : %.3f",PP);
  29.  
  30. return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement