Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int neededProcessors, workers, days, dayliWorkingHours = 8, processorBuildHours = 3;
- cin >> neededProcessors >> workers >> days;
- double processorPrice = 110.10;
- double diff = (neededProcessors - floor(workers * days * dayliWorkingHours / processorBuildHours)) * processorPrice;
- if (diff > 0) {
- printf("Losses: -> %.2f BGN\n", diff);
- }
- else {
- printf("Profit: -> %.2f BGN\n", abs(diff));
- }
- return 0;
- }
- Или леко тарикатската с тернарен оператор:)
- #include <iostream>
- using namespace std;
- int main() {
- int neededProcessors, workers, days;
- cin >> neededProcessors >> workers >> days;
- double diff = (neededProcessors - workers * days * 8 / 3) * 110.10;
- printf("%s: -> % .2f BGN\n",diff > 0 ? "Losses" : "Profit", abs(diff));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement