Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #define rate 0.50
- float calulatecharges(float hour);
- int main(void){
- int car=0;
- float hour=0.0;
- while(hour!=-1){
- car ++;
- printf("\nhour: ");
- scanf("%f",&hour);
- printf("Macchina n.\tore\tcosto\n%d\t%f\t%f",car,hour,calulatecharges(hour));
- }
- }
- float calulatecharges(float hour){
- float tot=0;
- if(hour>3){
- tot=((hour -3)*rate)+2;
- return tot;
- }else{
- tot=2.0;
- return tot;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement