Warm-up Exercises
-
Explain Boolean type bool and the meaning of logical operations AND (&&), OR (||) and negation (!). Provide a small example.
-
Declare a variable of type int, with value 3.
Questions
-
Write a statement that initializes a variable named myHeightInMeters to your height in meters. What should be the datatype of myHeightInMeters, and why?
-
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();
- What is the difference, if any, between 3 and “3”?
Problems
- Declare and initialize 3 variables:
- Each variable should have a different data type
- Choose an appropriate name and value for each variable Then display the value of each variable on the screen.