Login to ask a question from C Programs on integers

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

#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);

....

Show More
Previous Question Next Question
🔗

Similar Questions

From C Programs on integers · C programming

View All
WhatsApp