Advertisement
Guest User

Untitled

a guest
Jan 21st, 2019
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #define rate 0.50
  4. float calulatecharges(float hour);
  5. int main(void){
  6. int car=0;
  7. float hour=0.0;
  8. while(hour!=-1){
  9. car ++;
  10. printf("\nhour: ");
  11. scanf("%f",&hour);
  12. printf("Macchina n.\tore\tcosto\n%d\t%f\t%f",car,hour,calulatecharges(hour));
  13.  
  14. }
  15. }
  16. float calulatecharges(float hour){
  17. float tot=0;
  18. if(hour>3){
  19. tot=((hour -3)*rate)+2;
  20. return tot;
  21. }else{
  22. tot=2.0;
  23. return tot;
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement