C program to check odd or even using Conditional (Ternary) Operator

C Program to check whether a given number is odd or even using Conditional (Ternary) Operator

This page has a C programs to check odd or even using Conditional (Ternary) Operator. This C program is to check odd or even using Conditional (Ternary) Operator. The Odd and Even numbers are in the Integer families. Even number can be divided by 2 and gives zero as remainder. The Even numbers examples are 0,2,4,6,8, . . .  When we divide the Odd number, the remainder will be one. The Odd number examples are 1,3,5,7,9,11,13, . . .  The below given C program is used to check whether a number is Odd or Even using Conditional (Ternary) Operator. Kindly check out the Odd or Even program using Conditional (Ternary) Operator. The odd or even program can be asked in different ways 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 odd or even  (10).  Program to find a given number is odd or even  (11). Program to find a number is odd or even  (12). Program to find odd or even  (13).  Program to check odd or even.

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


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


Sample outputs:

  Enter an integer number: 923

  923 is an odd number.

  Enter an integer number: 738

  738 is an even number.


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

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