Hello all, this is my first post on the Forum. I'm trying to learn Java programming, but I'm already stuck. Can someone help me with the practice exercise below? I don't yet understand loops. Thanks very much.
Write a program that makes an int variable num and sets it equal to some large number (like 200). Then use an if statement in a while loop that prints out "num is an even number" if num is even (hint: you can use (num % 2) == 0 to test if num is even. The % operator is the "modulo" operator, and it basically calculates the remainder when dividing two numbers).
Write a program that makes an int variable num and sets it equal to some large number (like 200). Then use an if statement in a while loop that prints out "num is an even number" if num is even (hint: you can use (num % 2) == 0 to test if num is even. The % operator is the "modulo" operator, and it basically calculates the remainder when dividing two numbers).
Comment