Exercise: Conditions
Try this exercise to practice your skills in conditions.
We'll cover the following
Problem statement
You are tasked with creating a program that utilizes an if
/else
statement to evaluate a player’s health score and print a corresponding message based on the score.
Sample input
The input is an integer representing the player’s health score, ranging from 0 to 100.
Expected output
The program should print one of the following messages, depending on the player’s health score:
The
You win!
message should be printed if the player’s health is 100.The
You lose!
message should be printed if the player’s health equals zero or goes below zero.The
Keep playing
message should be printed if the player’s health is between 1 and 99.
Your task is to implement a solution in C# that returns the appropriate message based on the provided player’s health score.
Get hands-on with 1400+ tech skills courses.