Jan 11, 2009

Write a c function for finding minimum of two numbers. You should not use if-then-else or ?: operators

Write a c function for finding minimum of two numbers. You should not use if-then-else or ?: operators

int min (int a, int b)
{
return ((a > b) * b + (a < b) * a);
}

No comments:

Post a Comment