Solutions for those exercises.

Warm-up Exercises

  1. Explain Boolean type bool and the meaning of logical operations AND (&&), OR (||) and negation (!). Provide a small example.

  2. Write a statement that declares a variable of type int and sits its value to 3.​

Questions

  1. Write a statement that initializes a variable named myHeightInMeters to your height in meters. What should be the datatype of myHeightInMeters, and why?

  2. What is wrong with the following? Will the error(s) appear at compilation time, or at execution time?

    int age;
    Console.WriteLine("Please enter your age:");
    age = Console.ReadLine();
  3. What is the difference, if any, between 3 and “3”?

Problems

  1. Declare and initialize 3 variables:

    1. Each variable should have a different data type
    2. Choose an appropriate name and value for each variable

    Then display the value of each variable on the screen.