Program to check whether the number is even or odd.| Using C language| very Basic| C Program series 10|
👨💻Program to accept a number and check whether the number is even or odd.
Code:
//Program to check whether the number is even or odd.
#include<stdio.h>
main()
{
printf("Program to check whether the number is even or odd.\n\n");
int number;
printf("Enter the number:");
scanf("%d",&number);
if(number%2==0)//If number is divisible by 2 (means remender is zero) then number is even.
{
printf("%d is EVEN number.",number);
}
else
{
printf("%d is ODD number.",number);
}
}
Output:
Comments
Post a Comment