Pages

Wednesday, February 10, 2016

Use of MODULUS (%) operator to find odd or even number.


#include<stdio.h>
int main()
{
 int number;

 printf("Enter number:");
 scanf("%d",&number);

 if(number%2 == 0)
  printf("Entered number is even.");
 else
  printf("Entered number is odd.");

 return 0;
}


Output of the program:


Enter number:51
Entered number is odd.




You may also like to learn following programs:

No comments:

Post a Comment