Showing posts with label C Program find Positive Negative with Switch Case Without Conditional Operator. Show all posts
Showing posts with label C Program find Positive Negative with Switch Case Without Conditional Operator. Show all posts

C Program find Positive Negative with Switch Case Without Conditional Operator


write a program in c to check whether the given num is Positive or negative using switch case without conditional operator

 ‎#include<stdio.h>
#include<conio.h>
void main(void)
{
char num;
clrscr();
printf("Enter a number +ve or -ve : ");
scanf("%c",&num);
switch(num)
{
case '-':
printf("Negative number");
break;
default:
printf("Positive number");
}
getch();
}

Labels