Skip to main content

Even Odd using switch

#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int num;
printf("Enter a Num:");
scanf("%d",&num);

int r = num%2==0                                                       //% is used to find remainder
switch(r)
{
case 1:
printf("Entered Number is Odd");
break;
case 0:
printf("Entered Number is Even");
}
getch();
}

Comments

Popular posts from this blog