+ 1
Help me c#
Ä°nt x=4 int y=9 x={x%y!=0}?y/x:y;
2 Answers
+ 8
Given the statements:
int x = 4, y = 9;
x = (x % y != 0) ? y / x : y;
We know:
â
x % y = 4 % 9 = 4
â
y / x = 9 / 4 = 2
The second statement comprises of assignment to x and a conditional statement (if-then-else).
x = (4 != 0) ? 2 : 9;
since the condition in bracket evaluates to true, we will take 2 instead of 9 (false).
Therefore:
x = 2
y = 9
+ 1
ıâm begginner thanks for answer