Write program to input a number and check number is odd or even.

In this program we input a number and check number is odd or even means if number is devide by 2 then we can say number is even number else odd number.

For learn this program you should knowledge of some simple conditional programs. That's link below.

#include<stdio.h>
#include<conio.h>
void main()
{
int n;
clrscr();
printf("Enter a number=");
scanf("%d",&n);
if(n%2==0)
  printf("Even number");
else
  printf("Odd number");
getch();
}

OUTPUT 

Enter a number=5
Odd number
              Or
Enter a number=4
Even number

Related Examples 


  1. Write a program to input two number and find the highest number.
  2. Write a program to input two number and find the smallest number.
  3. Write a program to input a number and check number is positive,negative or nuteral. 
  4. Write a program to input a number and check number is negative or not .
  5. Write a program to input a number and check number is positive or not. 


Follow for recently updates ,Share and Comment.

Comments

Popular posts from this blog

Write a program to input age of any person and check he is eligible for voting or not.

Write a program to input two digit number and check number is palindrome or not.

Write a program to input speed of Royal Enfield and check it's running at economic speed or not.