To find greater number without using of Logical and relational Operators

To find greater number without using of Logical & relational Operators





int maximum(int x, int y)
{
int fNum[2],temp,num[2];
num[0] = x;
num[1] = y;
temp=fNum[ Fun4Sign(x - y)];
return( temp);
}

int Fun4Sign(int sgn)
{
int temp;
temp= unsigned(sgn) >> (sizeof(int)*8-1); return(temp);
}



No comments:

Post a Comment