Question: Java Cody had a hard time saving The Programmer from the Hydra, so he decided to call his friends to help him cut off

Java 

 

Cody had a hard time saving The Programmer from the Hydra, so he decided to call his friends to help him cut off the heads together. This was brilliant because then the number of heads he has to cut would be far less than if he was all alone. 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.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!