Advertisement
Spocoman

Summer Shopping

Oct 7th, 2023
725
-1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 1
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.     double budget, towel, discount;
  8.     cin >> budget >> towel >> discount;
  9.  
  10.     double umbrella = towel / 3 * 2;
  11.     double flipFlops = umbrella * 0.75;
  12.     double beachBag = (towel + flipFlops) / 3;
  13.  
  14.     double sum = (towel + umbrella + flipFlops + beachBag) * (100 - discount) / 100;
  15.  
  16.     printf("Annie's sum is %.2f lv. ", sum);
  17.     if (budget >= sum) {
  18.         printf("She has %.2f lv. left.", budget - sum);
  19.     }
  20.     else {
  21.         printf("She needs %.2f lv. more.", sum - budget);
  22.     }
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement