-
toughie Q
*4. Write a single expression whose value is either -1, 0, or +1, depending on whether 'i' is less than, equal to, or greater than j, respectively.
... how would i go about figuring this *problem? ... i'm guessing it's a conditional statement... this is what i'm thinking ab this prob @ the moment:
i = 2; j = 1;
(a) i > j ...no clue ab this 1~
b) i = j ... 2 doesn't = 1 so "0" is the answer
c) i > j .... 2 IS greater than 1 so "1" is the answer
-
result=i==j?0:i<j?-1:1;
What a beautiful language .
Popular pages
Recent additions