Welcome To Grey Shield

Website is under Maintenance

c program to check whether the number is even or odd

 C program to check whether the number is even or odd


#include<stdio.h>

#include<conio.h>

intmain()

{

int number;

printf("Enter your number");

//take input from user

scanf("%d",&number);

//use if- else conditonal to check number is even or odd

if(number%2==0)

{

printf("Number is Even");

}

else

printf("number is odd");

return 0;

}


Output:

Enter your number 2

Number is Even




Description:

1. Even or Odd condition:-  We know the condition for even numbers. If any number is completely divide by 2 then that number will be even. for example- if we take a number 4 and divide it by 2 then it will divide completely 

if 4 % 2 then remainder will be 0.

In this case it will be even.

If you have any doubt, Please let me know

Previous Post Next Post

Contact Form