Getting 5 or 7 and returning the opposite?

102 Views Asked by At

I get 5 or 7 and if i get 5 i need to return 7 if i get 7 i need to return 5.

i need to do this in 1 mathematical formula.

I have those:

12 - x

35 / x

There are more solutions ?

Example in code:

public static int Transform(int x)
{
    return (12-x);
    //return (35/x);
}
1

There are 1 best solutions below

6
On

return x ^ 2;

Are you sure you aren't missing any constraints?