+ 1
Help me c#
İnt x=4 int y=9 x={x%y!=0}?y/x:y;
2 odpowiedzi
+ 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