Filled Under:

C Program to Check Whether a Number is Even or Odd

 C Program to Check Whether a Number is Even or Odd


C Program to Check Whether a Number is Even or Odd

A number is said to an odd number if it is not divisible by 2 i.e., the remainder of that division will not be equal to 0.

 C Program to Check Whether a Number is Even or Odd

------------------------------------------------------------------------------------------------------
#include<stdio.h>
void main()
{int a;
printf("Enter a number:");
scanf("%d",&a);
if(a%2==0)
{printf("The number is even");}
else
{printf("The number is odd");
}
}

-----------------------------------------------------------------------------------------------------

Just copy and paste the program in your desired compiler (Dev C++ is more preferable) and run it.

Enjoy programming in C.

0 comments:

Post a Comment

 

Copyright 2020 Programming in C All Right Reserved