Answer to Question #178387 in C++ for Tengku

Question #178387

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


1
Expert's answer
2021-04-05T11:06:10-0400
#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;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS