A hero and a monster start with the same health score. During the hero's turn to attack, the logic will generate a random value which will be subtracted from the monster's health. If the monster's health is greater than zero, they'll take their turn and attack the hero. As long as both the hero and the monster have health greater than zero, the battle will resume.
Used a do-while statement.
The hero and the monster will start with 10 health points.
All attacks will be a value between 1 and 10.
The hero will attack first.
Prints the amount of health the monster lost and their remaining health.
If the monster's health is greater than 0, it can attack the hero.
Prints the amount of health the hero lost and their remaining health.
Continue this sequence of attacking until either the monster's health or hero's health is zero or less.
Print the winner.