Pages

Sunday, 20 September 2015

A number odd or or even without using modulo operator

A number odd or or even without using modulo operator

Coding:

#include<stdio.h>
int main()
{
 int m;
 printf("Enter any number:");
 scanf("%d",&m);
 if(2*(m/2)==m)
 {
  printf("%d is even number",m);
 }
 else
 {
  printf("%d is odd number",m);
 }
 return 0;
}
Output:
Enter any number:7
7 is odd number