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
#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;
}

© 2021 Garbage Valuegarbage value logo