# 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 whether a Number 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.