printf("Number is a even number"); // print the message for true value
else
printf("Number is a odd number"); // print the message for false value.
return 0; // return statement.
}
Output:
If the user inputs is 2 then the output is "Number is a even number".
If the user inputs is 3 then the output is "Number is a odd number".
Explanation:
The above program is to check the even and odd number.
The first line of the program is used to include the header file which helps to understand the functions used in the program.
Then there is the main function that starts the execution of the program.
Then there is a variable declaration of number which is declared as an integer which takes the integer value because the program needs the integer only.
Then the scanf function is used to take the inputs from the user.
Then the if condition check that the number is divisible by 2 or not.
If it is divisible print "even number" otherwise print "odd-number".