Advertisement
Spocoman

Sweet Dessert

Oct 1st, 2023
862
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.     double budget, guests, bananaPrice, eggPrice, berriesKiloPrice;
  8.     cin >> budget >> guests >> bananaPrice >> eggPrice >> berriesKiloPrice;
  9.  
  10.     double neededMoney = ceil(guests / 6) * (bananaPrice * 2 + eggPrice * 4 + berriesKiloPrice / 5);
  11.  
  12.     if (budget >= neededMoney) {
  13.         printf("Ivancho has enough money - it would cost %.2flv.", neededMoney);
  14.     }
  15.     else {
  16.         printf("Ivancho will have to withdraw money - he will need %.2flv more.", neededMoney - budget);
  17.     }
  18.     return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement