Can someone explain this one? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can someone explain this one?

int x=12; x = x<<3; Console.WriteLine(x);

12th Mar 2017, 9:22 AM
Milos Petrovic
Milos Petrovic - avatar
2 Answers
+ 15
<< means left shift it double the data as many times the right side value is one by one x=12 and left shift three times x=24 in first shift x=48 in second shift and x=96 in third shift i.e., the final value of x is 96
12th Mar 2017, 9:30 AM
Mansi Dagla
Mansi Dagla - avatar
0
Thanks for answer its very helpful :D
12th Mar 2017, 9:32 AM
Milos Petrovic
Milos Petrovic - avatar