C program to Check Whether the Given Number is Even or Odd.
Even numbers are integers that are completely divisible by 2 and has no remainder. For example- 2, 4, 6, 8, 0
Odd numbers are not completely divisible by 2. either leaves a remainder or the result is a fraction. For example- 1, 3, 5, 7, 9.
Here is, Program to check Even or Odd.
#include<stdio.h>
#include<conio.h>
void main()
{
int num;
printf("enter number = ");
scanf("%d",& num);
if(num%2==0)
printf("The number is Even");
else
printf("The number is Odd");
getch();
}
Output:
When user enter the even number the output is..
Even numbers are integers that are completely divisible by 2 and has no remainder. For example- 2, 4, 6, 8, 0
Odd numbers are not completely divisible by 2. either leaves a remainder or the result is a fraction. For example- 1, 3, 5, 7, 9.
Here is, Program to check Even or Odd.
#include<stdio.h>
#include<conio.h>
void main()
{
int num;
printf("enter number = ");
scanf("%d",& num);
if(num%2==0)
printf("The number is Even");
else
printf("The number is Odd");
getch();
}
Output:
When user enter the even number the output is..
When user enter the Odd number the output is.
No comments:
Post a Comment