Write a program that will find out whether the given number is even or odd. If odd number then whether it is prime or not.
Answers
Answered by
1
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.
Similar questions