Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main() {
- double budget, guests, bananaPrice, eggPrice, berriesKiloPrice;
- cin >> budget >> guests >> bananaPrice >> eggPrice >> berriesKiloPrice;
- double neededMoney = ceil(guests / 6) * (bananaPrice * 2 + eggPrice * 4 + berriesKiloPrice / 5);
- if (budget >= neededMoney) {
- printf("Ivancho has enough money - it would cost %.2flv.", neededMoney);
- }
- else {
- printf("Ivancho will have to withdraw money - he will need %.2flv more.", neededMoney - budget);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement