Four workers were responsible to pluck oranges. The owner of the orange farm will be given 40% of the oranges. The workers share equally the balance of the oranges. The balance of oranges after divided will be used to make juice. You are also required to calculate and print amount of oranges that were received by the owner, each of the workers and balance of oranges to make juice. Write a program.
Sample output:
Enter number of oranges plucked : 100
Total oranges for the owner is 40
Total oranges for each worker is 15
Balance of oranges to make juice is 0
***********another output sample**************
Enter number of oranges plucked : 125 Total oranges for the owner is 50 Total oranges for each worker is 18 Balance of oranges to make juice is 3
#include <iostream>
using namespace std;
int main()
{
int numOranges = 0;
cout << "Enter number of oranges plucked: ";
cin >> numOranges;
cout << "Total oranges for the owner is " << (numOranges * 4) / 10 << endl;
cout << "Total oranges for each worker is " << (numOranges - (numOranges * 4) / 10) / 4 << endl;
cout << "Balance of oranges to make juice is " << numOranges - (numOranges * 4) / 10 - ((numOranges - (numOranges * 4) / 10) / 4) * 4 << endl;
return 0;
}
Comments
Leave a comment