Answer to Question #324029 in C++ for ness

Question #324029

For example, if the Hydra had 10 heads and he called 5 friends then they would each cut 2 heads. This presented a problem, however, if the Hydra had 11 heads then that meant one of them had to cut 3 heads.


Input the number of friends Cody has to call and the number of heads the Hydra currently has and then print the minimum number of heads each one of them has to cut.


1
Expert's answer
2022-04-05T13:18:09-0400
#include <iostream>

using namespace std;

int main()
{
	int heads, friends;
	cout << "Please, enter the number of friends Cody has: ";
	cin >> friends;
	cout << "Please, enter the number of heads the Hydra currently has: ";
	cin >> heads;
	int minHeads = heads / friends;
	cout << "The minimum number of heads each one of them has to cut is " << minHeads;
}

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