Advertisement
Spocoman

Easter Party

Sep 17th, 2023
836
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.70 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.     int guest;
  8.     cin >> guest;
  9.  
  10.     double envelope, budget;
  11.     cin >> envelope >> budget;
  12.  
  13.     double sum = guest * envelope;
  14.  
  15.     if (guest >= 10 && guest <= 15) {
  16.         sum *= 0.85;
  17.     }
  18.     else if (guest > 15 && guest <= 20) {
  19.         sum *= 0.80;
  20.     }
  21.     else if (guest > 20) {
  22.         sum *= 0.75;
  23.     }
  24.  
  25.     sum += budget / 10;
  26.  
  27.     if (budget >= sum) {
  28.         cout << "It is party time! " << fixed << setprecision(2) << budget - sum << " leva left.\n";
  29.     }
  30.     else {
  31.         cout << "No party! " << fixed << setprecision(2) << sum - budget << " leva needed.\n";
  32.     }
  33.     return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement