Labs
- Write a program that reads an
intnumber from the user. Use an expression to determine if the number is even (use the modulus operator,%.) Store the result of the expression in abooleanvariable. Write anifstatement that uses the variable to determine whether to printOdd.orEven..
(Solution: solutions/OddOrEven.java)
- Write a program that prompts the user five times to enter an integer number. The first time, store the number in an
intvariable, and print it out. The remaining four times, use*=to multiply the variable by the user's input and print it again.
(Solution: solutions/Multiply.java)
- Write a program that reads a number from the user and prints out whether the number is positive, negative, or zero. Use no
ifstatements.
(Solution: solutions/PosNegZero.java)