To gain a solid understanding of Operators, System Input/Output, Conditional Statements, and Relational and Boolean Operators.
- Write a program
evenodd.c
to check if a user-input number is even or odd. You can assume the user enters an integer. - Write a program
threenums.c
that takes in 3 user-input numbers and prints “numbers are equal” if all 3 numbers are equal, and “not equal”, followed by the largest number, if the numbers are not equal. Then print out the sum of the 3 numbers.
-
What is the outcome of the following conditional statements if the value of variable x is 5? Show your work.
a.
x <= 4 || (x != 9 && x > 10)
b.
x > 0 && x < 10 && x != 6
c.
x == 1 || x > 0
-
Can we use string value/variable in switch test condition? Why or why not?
-
What is wrong with the following code snippet? As written, what will it do?
int userIn;
scanf(“%d”, userIn);
Please include your name and a description in a comment at the top of your code files. Please also include your name at the top of your assignment2.txt file.
All files must be submitted via GitHub by 10:00am 7/22.