6.0b: Challenge Answers
Bronze:
class Program
{
static void Main(string[] args)
{
int value = 100 / 2;
if (value == 50)
{
Console.WriteLine(true);
}
else
{
Console.WriteLine(false);
}
}
}Silver:
Gold:
Your programs may vary a little bit but it should look something like this:
1. Print the rules of the game to the console 2. Save the user's input to the ReadLine() and use Convert.ToInt16() so the program will convert the user's input back to a string 3. Create if, else if, and else statements inputting the range the statement will use and the data the program will spit out if the statement is true. 4. Try typing if then press the tab key twice and it will scaffold out an if statement for you.
Discussion
if statements will always be run within the program. Else if statements will only be run if the previous statements were not true. Else statements will only be run if none of the other statements were true.
Next: Conditionals
Last updated