C Program to Check Whether a Number is Even or Odd

Source Code to Check Whether a Number is Even or Odd


/*C program to check whether a number entered by user is even or odd. */

#include <stdio.h>
int main(){
int num;
printf
("Enter an integer you want to check: ");
scanf
("%d",&num);
if((num%2)==0) /* Checking whether remainder is 0 or not. */
printf
("%d is even.",num);
else
printf
("%d is odd.",num);
return 0;
}
Output 1

Enter an integer you want to check: 25
25 is odd.

0 comments:

Post a Comment

My Instagram