C Program to Calculate the Sum of Odd & Even Numbers:
C Program to Check if a given Integer is Odd or Even:
Problem Description
The program takes the given integer and checks whether the integer is odd or even.
Problem Solution
Take the integer to be checked as input.
Find the remainder of the integer by dividing it by 2.
Use if,else statement to check whether the remainder is equal to zero or not.
Print the output and exit.
Program/Source Code
Show More#include
void main()
{
int ival, remainder;
printf("Enter an integer : ");
scanf("%d", &ival);
remainder = ival % 2;
if (remainder == 0)
printf("%d is an even integer\n", ival);
....
All Chapters — C programming
Similar Questions
From C Programs on integers · C programming
C Program to Accept two Integers and Check if they are Equal:
.C Program to Find the Number of Integers Divisible by 5 in a given range:
C Program to Check if a given Integer is Positive or Negative:
C Program to Read Two Integers M and N & Swap their Values:
C Program to Compute the Sum of Digits in a given Integer: