Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int plannedCakes;
- cin >> plannedCakes;
- double cakeFlour;
- cin >> cakeFlour;
- int flourAvailable, truffleCount, trufflePrice;
- cin >> flourAvailable >> truffleCount >> trufflePrice;
- int cakes = (int)(flourAvailable / cakeFlour);
- if (cakes >= plannedCakes) {
- double cakePrice = (double)truffleCount * trufflePrice / plannedCakes * 1.25;
- printf("All products available, price of a cake: %.2f", cakePrice);
- }
- else {
- double flourNeeded = plannedCakes * cakeFlour - flourAvailable;
- printf("Can make only %i cakes, need %.2f kg more flour", cakes, flourNeeded);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement