what is the output of this code?? int x = 15; int y =6; x% =y; Console.WriteLine(x); | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 7

what is the output of this code?? int x = 15; int y =6; x% =y; Console.WriteLine(x);

10th Jul 2016, 2:19 AM
marl tidalgo
marl tidalgo - avatar
18 Answers
+ 1
Because % gives the remainder so if we divide 15 by 6 it's remainder will be 3
10th Jul 2016, 3:30 AM
nitin sharma
nitin sharma - avatar
+ 1
3
10th Jul 2016, 5:06 PM
Christian Moncada
Christian Moncada - avatar
+ 1
3
11th Jul 2016, 10:18 AM
Mehran
Mehran - avatar
+ 1
3
4th Jul 2019, 10:46 AM
ARAVINDA NARAYAN B.S.
+ 1
What is the output of this code? int x = 16; int y = 5; Console.WriteLine(x/y);
11th Nov 2022, 1:33 PM
Mekonnen Degfie
Mekonnen Degfie - avatar
+ 1
3
24th Mar 2023, 9:47 AM
Pawan
Pawan - avatar
0
Hi the output will be 3
10th Jul 2016, 3:29 AM
nitin sharma
nitin sharma - avatar
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
10th Jul 2016, 4:54 AM
Pamu Vineeth
Pamu Vineeth - avatar
0
3
10th Jul 2016, 5:06 AM
Vikram Choudhary
0
x%=y means x=x%y ie; x=15%6, x=3(remainder of 15/6)
10th Jul 2016, 7:12 AM
VishnuPriya
0
x=x%y;x=3
10th Jul 2016, 7:55 AM
Raaman Kilaru
Raaman Kilaru - avatar
0
3
11th Jul 2016, 11:07 AM
Alper Ergünşen
Alper Ergünşen - avatar
0
3
19th Sep 2016, 5:20 PM
venkata veerendra manikumar kancharla
venkata veerendra manikumar kancharla - avatar
0
fill in missing parentheses to have x = 15 int x= ........2+3........*3;
9th Aug 2017, 4:02 AM
SADAK MOHAMED AHMED
SADAK MOHAMED AHMED - avatar
0
It is confusing 2.5 is the answer when you divide 15/6.
14th Mar 2021, 1:17 AM
Karen R Scott
0
3
9th Oct 2021, 10:02 AM
Sunitha Rajakumaran
Sunitha Rajakumaran - avatar
0
3
1st Apr 2023, 8:20 AM
Pawan
Pawan - avatar
0
int x = 15; x++; x = x-2; Console.WriteLine(x);
29th Jun 2023, 6:10 AM
VENKATESHWARAN P
VENKATESHWARAN P - avatar