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.
#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;
}
Comments
Leave a comment