+ 1

Help me c#

Ä°nt x=4 int y=9 x={x%y!=0}?y/x:y;

18th Mar 2020, 8:44 PM
Dogukan Yıldız
Dogukan Yıldız - avatar
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
19th Mar 2020, 3:00 AM
Zephyr Koo
Zephyr Koo - avatar
+ 1
ı’m begginner thanks for answer
19th Mar 2020, 1:27 PM
Dogukan Yıldız
Dogukan Yıldız - avatar