Odd and even number in ‘C’

This is a program to check if a number is even or odd in the ‘C’ programming language.

We can do this by first getting the number from the user.

The logic:

A number will be even if it is divisible by 2. Elaborating more, when the number is divided by 2, if there is a remainder of 0, the number is even , else it is odd.

We will make use of the ‘if-else’ statement to do this program.

Here is the code:

This will be the output of the program

As always, this code can be compiled and run at this online compiler

Online C Compiler – Programiz

Note: This code is not ChatGPT generated 🙂

This is the next post for BlogchatterHalfMarathon by @blogchatter

(Visited 22 times, 1 visits today)

Related Posts

Leave a Reply