Answer to Question #312516 in C++ for llll

Question #312516

 An egg distribution company uses different sizes of packings for eggs, that is, 30 eggs  packing, 24 eggs packing, 18 eggs packing, 12 eggs packing and 6 eggs packing. Write a program which  prompts user to enter total number of eggs (input validation is always must) to be packed and then  calculate how many packings of each size will be possible. Also tell if there will be any eggs left to be  packed. (10 marks) 




1
Expert's answer
2022-03-16T07:09:01-0400

Here is program:

int main()
{
	int eggs;
	cin >> eggs;
	while(eggs < 0)
	{
		if (eggs == 30)
		{
			eggs - 30;
		}
		else if (eggs == 24)
		{
			eggs - 24;
		}
		else if (eggs == 18)
		{
			eggs - 18;
		}
		else if (eggs == 12)
		{
			eggs - 12;
		}
		else if (eggs == 6)
		{
			eggs - 6;
		}
		else
		{
			cout << eggs;
		}
	}
}

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