Chapter - 3: The Decision Control

Any integer is input through the keyboard. Write a program to find out whether it is an odd number or even number.


C
Sections
2
Exercises

A

B

C

D

E

F

G

H

I

J

K

1

2

3

4

5

6

7

8

9

10

11

12

#include<stdio.h>
#include<conio.h>
int main()
{
	int num;
	printf("Enter an integer : ");
	scanf("%d", &num);
	
	if(num%2 != 0)//odd
		printf("\n\nThe number is odd");
	else//even
		printf("\n\nThe number is even.");
	
	getch();
	return 0;
}

© 2020 Garbage Valuegarbage value logo