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
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
- Write a program to input two number and find the highest number.
- Write a program to input two number and find the smallest number.
- Write a program to input a number and check number is positive,negative or nuteral.
- Write a program to input a number and check number is negative or not .
- Write a program to input a number and check number is positive or not.
Follow for recently updates ,Share and Comment.
Comments
Post a Comment