Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main() {
- float caravan = 3;
- float camper = 3;
- float pricePerDayForThreeCaravans = 90;
- float pricePerDayForThreeCampers = 100;
- float camperOrCaravan = 0;
- float holidayDays = 0;
- float totalSumForPay = 0;
- printf("Hello mr/ms, What would you like a camper or caravan? For camper press 1, for caravan press 2! :");
- scanf("%f", &camperOrCaravan);
- if (camperOrCaravan == 1){
- printf("\nGood choice! Now how many days would you like for your vacation: ");
- scanf("%f", &holidayDays);
- totalSumForPay = (pricePerDayForThreeCaravans / caravan) * holidayDays;
- printf("Your total amount for pay is: %.2fBGN", totalSumForPay);
- }
- else if (camperOrCaravan == 2){
- printf("\nGood choice! Now how many days would you like for your vacation: ");
- scanf("%f", &holidayDays);
- totalSumForPay = (pricePerDayForThreeCampers / camper) * holidayDays;
- printf("Your total amount for pay is: %.2fBGN", totalSumForPay);
- }
- else if (camperOrCaravan > 2 || camperOrCaravan < 1) {
- printf("Invalid choice");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement