Check Whether The Number Is Positive, Negative Or Zero With Switch Statement - HelpMeOutAlways

Wednesday, June 13, 2018

Check Whether The Number Is Positive, Negative Or Zero With Switch Statement

#include<stdio.h>
main()
{
int num;
printf("Enter any Number To Check It is Positive or Negative:\n");
scanf("%d",&num);
switch(num>0)
{
case 1:
printf("%d is positive number",num);
break;
case 0:
switch(num<0)
{
case 1:
printf("%d is negative number",num);
break;

case 0:
printf("%d is zero",num);
break;

}
break;

}

return 0;
}

switch example In C

switch case example

Switch Case Example In C

No comments:

@way2themes