Advertisement
Spocoman

Football Kit

Sep 19th, 2023
797
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.66 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.  
  8.     double shirtPrice, neededSum;
  9.     cin >> shirtPrice >> neededSum;
  10.  
  11.     double shortsPrice = 0.75 * shirtPrice;
  12.     double socksPrice = 0.20 * shortsPrice;
  13.     double sneakersPrice = (shirtPrice + shortsPrice) * 2;
  14.  
  15.     double sum = 0.85 * (shirtPrice + shortsPrice + socksPrice + sneakersPrice);
  16.  
  17.     if (neededSum <= sum) {
  18.         printf("Yes, he will earn the world-cup replica ball!\nHis sum is %.2f lv.\n", sum);
  19.     }
  20.     else {
  21.         printf("No, he will not earn the world-cup replica ball.\n He needs %.2f lv. more.\n", neededSum - sum);
  22.     }
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement