Program to Check a whether a Number is Odd or Even using Switch Case
Program to Check a whether a Number is Odd or Even using Switch Case
#include<stdio.h>
int main(){
int number,remainder;
clrscr();
printf(” Enter an integer number: “);
scanf(“%d”,&number);
remainder = abs(number) % 2;
switch(remainder){
case 0 : printf(“\n %d is an even number.”,number);
break;
case 1 : printf(“\n %d is an odd number.”,number);
break;
}
getch();
return 0;
}