Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main() {
- int days;
- cin >> days;
- double availableFoodInKg, dogFoodPerDayInKg, catFoodPerDayInKg, turtleFoodPerDayInGrams;
- cin >> availableFoodInKg >> dogFoodPerDayInKg >> catFoodPerDayInKg >> turtleFoodPerDayInGrams;
- availableFoodInKg -= (dogFoodPerDayInKg + catFoodPerDayInKg + turtleFoodPerDayInGrams / 1000) * days;
- if (availableFoodInKg >= 0) {
- cout << floor(availableFoodInKg) << " kilos of food left." << endl;
- }
- else {
- cout << ceil(abs(availableFoodInKg)) << " more kilos of food are needed." << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement