Who Wins?
The hero has only heroHealth health, 100 at the start, so losing 108 would be too much. Luckily, the hero has armor. It's in a new variable, armor, which holds "none", "leather" or "iron". Each of the dragon's strikes takes 4 health less from a hero in leather armor, and 8 less from a hero in iron armor. In leather armor, each strike takes only 14 health, so 6 strikes take 84. The armor doesn't change how many times the dragon strikes.
Take the armor into account in the damage that the program prints, and below it, print who wins the fight. The hero wins when they still have some health left after all of the dragon's strikes. With 0 health or less, the dragon wins. For our hero in leather armor, the whole output is:
Hits needed: 7
Dragon's strikes: 6
Damage taken: 84
The hero wins. Health left: 16The hero doesn't always win. Without armor, with armor = "none", the hero loses 108 health, and the program prints The dragon wins. instead.
Instructions
Take the armor into account: print how much health the hero loses in it.
Below that, print who wins the fight. When the hero wins, print how much health is left too, as in the example.
Start programming for free
2/3