-
Notifications
You must be signed in to change notification settings - Fork 1
LAB 1
Ankita Wankhede edited this page Jun 12, 2017
·
9 revisions
PROGRAM 1 : Check whether a number entered by a user is even or odd
In the program, integer entered by the user is stored in variable number.
Then, whether the number is perfectly divisible by 2 or not is checked using modulus operator.
If the number is perfectly divisible by 2, test expression number%2 == 0 evaluates to 1 (true) and the number is even.
However, if the test expression evaluates to 0 (false), the number is odd.
Here is the output