6.0a: Boolean Challenge

In this module, we'll attempt to conquer some boolean challenges.

File Location

  1. Right click on the solution.

  2. Go to Add > New Project.

  3. Select Console App (.NET Framework) and name it 06_boolean_challenges.

  4. Write your code for this module within Program.cs of that project.

The following challenges will build upon the code from the last challenge, reproduced here:

class Program
{
    static void Main(string[] args)
    {
        int value = 100 / 2;
        if (value == 50)
        {
            Console.WriteLine(true);
        }
    }
}

Bronze Challenge

In addition to printing true if the value is 50, print false if it is not 50.

Silver Challenge

In the example above, change 100 to 101, you still get true, but 101/2 is not 50. How can you handle this?

Gold Challenge

Create a program where the user has to guess what number the program is thinking of. The user will enter in a number, then the program will hit different boolean logic and spit some data back to the user telling them whether they need to go higher or lower. In this challenge you can just pick the winning number.

Answers

Last updated