C program to check odd or even

C program to check odd or even

This page has 3 C programs to check odd or even. First program to check odd or even using switch . . . case statement, the second program is to check odd or even using function and other by using if statement. Even number is an Integer number. Even number can be divided by 2. The remainder after dividing an even number by 2 is zero. The Even numbers examples are 0,2,4,6,8, . . . Odd number is an Integer number. Odd number can not be divided by 2. The Odd number examples are 1,3,5,7,9,11,13, . . . The remainder after dividing an Odd number by 2 is one. The below given C programs are used to check whether a number is Odd or Even. Kindly check out the Odd or Even program.

How will ask the programs to check odd or even

The odd or even program can be asked in different ways for school and college going students. The odd or even program question may be asked as (1). C Program to check Whether a Number is Even or Odd. (2). C program for checking odd or even number  (3). C program to check a Number is odd or even  (4). C Program to check whether the given Number is Even or Odd  (5). C Program to check if number is even or odd  (6). C Program to check if number is odd or even number  (7). C Program to check Odd or Even numbers  (8). C Program to check number is Even or Odd  (9). Program to find whether the given number is odd or even  (10).  Program to find a given number is even or odd  (11). Program to find a number is odd or even  (12). Program to find odd or even  (13).  Program to check odd or even.

1. Program to Check a whether a Number is Odd or Even using Switch . . .  Case


  #include<stdio.h>
  int main(){
             int numberin,remain;
             clrscr();
             printf(" Give a whole number: ");
             scanf("%d",&numberin);
             remain = abs(numberin) % 2;
             switch(remain){
                          case 0 : printf("\n %d is an even number.",numberin);
                                       break;
                          case 1 : printf("\n %d is an odd number.",numberin);
                                       break;
                                         }
  getch();
  return 0;
  }


Sample outputs:

  Give a whole number:  3725

  3725 is an odd number.

  Give a whole number:  -26

  -26 is an even number.


2. Program to Check whetherNumber is Odd or Even using function


  #include<stdio.h>
  void evenodd(int);
  int main(){
              int numbe;
              clrscr();
              printf(" Enter a number: ");
              scanf("%d",&numbe);
              evenodd(numbe);
              getch();
              return(0);
              }

  void evenodd(int nume){
             int remaine;
             remaine = abs(nume) % 2;
             switch(remaine){
                        case 0 : printf("\n %d is an even.",nume);
                                     break;
                        case 1 : printf("\n %d is an odd.",nume);
                                     break;
             return(0);
             }
             }


Sample outputs:

  Enter a number: 37

  37 is an odd.

  Enter a number: -206

  -206 is an even.


3. Program to Check whether a Number is Odd or Even using Conditional Operator


  #include<stdio.h>
  int main(){
              int numr;
              printf(" Enter an integer number: ");
              scanf("%d",&numr);
              (numr % 2)?printf("\n %d is odd number.",numr):printf("\n %d is even number.",numr);
              getch();
              return(0);
              }


Sample outputs:

  Enter an integer number: 93

  93 is odd number.

  Enter an integer number: 38

  38 is even number.


4. Program to Check whether a Number is Odd or Even using if statement


#include<stdio.h> 

int main(){

    int nu,re;

    printf("  Give an integer number: ");

    scanf("%d",&nu);

    re = nu % 2;

    if(re == 0)

         printf("\n  %d is an even number.",nu);

    else

         printf("\n  %d is an odd number.",nu); 

    return 0; 


Sample outputs:

  Give an integer number: 17

  17 is an odd number.

  Give an integer number: 26

  26 is an even number.


Most Related Even or Odd Programs in C


* C program to check even or odd using Bitwise Operator

* C program to find Sum of Odd Digits of a Number

C program to find Sum of Even Digits of a Number

* C program to find Sum of Even and Odd Digits of a Number

* C program to print Odd Digits of a Number

* C program to print Even Digits of a Number

* C program to display Odd numbers from the given N numbers

* C program to display Even numbers from the given N numbers

* C program to check whether a number is odd or even

* C program to check odd or even using if else
* C program to check odd or even using switch case
* C program to check odd or even using function
* C program to check odd or even using Ternary Operator

About Er. T.Tharesh Kumar

I am a Professor and Head of Department of Computer Science in an Arts and Science College. I have designed this website to provide solved example programs of different categories for all the school and college going students to learn C language deeply, and to practice Interview based Multiple Choice (Objective Type) questions and answers.

Other Related C Programs :


* C Program to find whether the given number is Odd or Even

* C Program to find the Sum of Odd Digits

* C Program to find the Sum of Even Digits

* C Program to find the Sum of Even and Odd Digits,

* C Program to Display Odd digits

* C Program to Display even digits

* C Program to Display Odd Numbers,

* C Program to Display Even Numbers,

* C Program to Check whether the given number is Armstrong number

* C Program to display the Armstrong numbers in Range

* C Program to display the Armstrong numbers between 1 and 1000

* C Program to check perfect number, perfect numbers in range

* C Program to Check Prime number, Prime numbers between 1 and 100

* C Program to display the Prime numbers in a Range

* C Program to display the Sum of Prime numbers

* C Program to Check Strong number

* C Program to display the Strong number in Range

* C Program to Check whether the given number is polindrome number or not

* C Program to Check polindrome number using for loop

* C Program to Check polindrome number using Recursion

* C Program to  check whether the given string is polindrome or not

* C Program to find the Roots of Quadratic equation

* C Program to display Fibonacci Series

* C Program to display the Fibonacci Series using an array

* C Program to display the Fibonacci Series using while loop

* C Program to find the Sum of Fibonacci Series, Factorial of Number

* C Program to find the Factorial without using Recursion

* C Program to find the Factorial using Pointers

* C Program to find the Factorial using Function

  • Questions and answers
  • Download Pdf
  • Answers
  • Interviews
  • Solved
  • And College
  • Antivirus Program

  • Armstrong atlantic state university
  • Business card templates
  • C Program
  • Questions and answers

Even or Odd program in C

The Even or Odd program in C is used to test the given number and to specify whether the number belongs to Even or Odd. It is clear that the remainder after the division of Even number by 2 will be Zero, and the remainder after the division of Odd number by 2 will be one. The Even and Odd numbers are generally belongs to Integer. The Even and Odd numbers may have no decimal point.

Bookmark and Share