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.
int value, rem;
printf("Enter an int ");
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.