Write a program to check whether the given number is even or odd in c

Write a program to check whether the given number is even or odd in c. The software takes an integer and determines if it is odd or even. Here’s the source code for a C program that determines whether a number is odd or even.

#include <stdio.h>
void main()
int value, rem;
printf("Enter an int ");
scanf("%d", &value);
rem = value % 2;
if (rem == 0)
printf("%d is an even int\n", value);
printf("%d is an odd int\n", value);



Enter an int 45
45 is an odd int

How to print the odd or even number in c

To check an integer, the user must first enter it into the variable value. Divide the variable value by 2 to get the remainder of the integer, which is stored in the variable remainder. To see if the value of the variable residual is equal to zero, use the if,else expression. If it equals zero, print “the integer is an even integer” as the output.

What is remainder in c program

The residual is the quantity “left over” after executing a calculation in mathematics. The residual is the integer that remains after dividing one integer by another to obtain an integer quotient in arithmetic.

What is even number in c program

A whole number that may be split into two equal whole numbers by two. Even numbers are zero, two, four, six, and eight.

What is odd number in c program

Whole numbers that cannot be split perfectly into pairs are known as odd numbers.
Odd numbers have a residual of one when divided by two.