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.
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.