- 7
what is the output of this code?? int x = 15; int y =6; x% =y; Console.WriteLine(x);
21 Answers
+ 1
Because % gives the remainder so if we divide 15 by 6 it's remainder will be 3
+ 1
3
+ 1
3
+ 1
3
+ 1
What is the output of this code?
int x = 16;
int y = 5;
Console.WriteLine(x/y);
+ 1
3
0
Hi the output will be 3
0
here x%=y is same as x=x%y; and using % operator it always gives remainder, so in this instance the output is 3
0
3
0
x%=y means x=x%y ie; x=15%6, x=3(remainder of 15/6)
0
x=x%y;x=3
0
3
0
3
0
fill in missing parentheses to have x = 15
int x= ........2+3........*3;
0
It is confusing 2.5 is the answer when you divide 15/6.
0
3
0
3
0
int x = 15;
x++;
x = x-2;
Console.WriteLine(x);
0
3
0
3