Thu May 24 2018

Even Odd

C Programming869 views

File Name: even-odd.c

#include<stdio.h>

int main() {
	int no;
	printf("Check the given number is Odd or Even\n");
	printf("Enter a number:\n");
	scanf("%d", &no);

	/* Check the modulus of 'no' is zero or not */
	if(no % 2 == 0)
		printf("It's a Even Number!\n");
	else
		printf("It's a Odd Number!\n");
	return 0;
}


/* Output */
Check the given number is Odd or Even
Enter a number:
6

It's a Even Number!

/* ---------------------------------------- */

Check the given number is Odd or Even
Enter a number:
5

It's a Odd Number!

We use cookies to improve your experience on our site and to show you personalised advertising. Please read our cookie policy and privacy policy.