Showing posts with label how 2 find a given number is positive or negative number in C without using relational and conditional operator. Show all posts
Showing posts with label how 2 find a given number is positive or negative number in C without using relational and conditional operator. Show all posts

how 2 find a given number is positive or negative number in C without using relational and conditional operator


‎# include<stdio.h>
# include<conio.h>
# include<math.h>
void main()
{
clrscr();
int p,n;
printf("Enter two no=");
scanf("%d",&p);
switch(n=abs(p)+(-p))
{
case 0:
{
printf("Positive number");
break;
}
default:
{
printf("Negative number");
break;
}
}
getch();
}

Labels