Chapter:

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

void main()

{

    int ival, remainder;

 

    printf("Enter an integer : ");

    scanf("%d", &ival);

    remainder = ival % 2;

 &nbs....

Show More

All Chapters

View all Chapter and number of question available From each chapter from C-programming-