Write a program in C to find odd or even number without using if else.
#include<stdio.h>
#include<conio.h>
void main()
{
int n;
clrscr();
printf("Enter a number .:-");
scanf("%d",&n);
switch(n%2)
{
case 0: printf("%d is even no.",n);
break;
default:printf("%d is odd no.",n);
}
getch();
}
0 Comments