Advertisement
HristoBaychev

5rest

Oct 5th, 2021
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.18 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3.  int main() {
  4.      float caravan = 3;
  5.      float camper = 3;
  6.      float pricePerDayForThreeCaravans = 90;
  7.      float pricePerDayForThreeCampers = 100;
  8.      
  9.  
  10.      float camperOrCaravan = 0;
  11.      float holidayDays = 0;
  12.      float totalSumForPay = 0;
  13.      
  14.      printf("Hello mr/ms, What would you like a camper or caravan? For camper press 1, for caravan press 2! :");
  15.      scanf("%f", &camperOrCaravan);
  16.      
  17.      if (camperOrCaravan == 1){
  18.      printf("\nGood choice! Now how many days would you like for your vacation: ");
  19.      scanf("%f", &holidayDays);
  20.          totalSumForPay = (pricePerDayForThreeCaravans  / caravan) * holidayDays;
  21.          printf("Your total amount for pay is: %.2fBGN", totalSumForPay);
  22.      }
  23.      else if (camperOrCaravan == 2){
  24.     printf("\nGood choice! Now how many days would you like for your vacation: ");
  25.      scanf("%f", &holidayDays);
  26.          totalSumForPay = (pricePerDayForThreeCampers / camper) * holidayDays;
  27.          printf("Your total amount for pay is: %.2fBGN", totalSumForPay);
  28.      }
  29.      else if (camperOrCaravan > 2 || camperOrCaravan < 1)   {
  30.          printf("Invalid choice");
  31.      }
  32.  
  33.  
  34.     return 0;
  35.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement