0

Why is the output 360 shouldn't it be 9?

int x = 3; Console.WriteLine ( 'x' * 3);

1st Nov 2018, 1:42 PM
John-Michael
1 Respuesta
+ 4
c, c++ and c# are low level languages so be careful. Here, 'x' is a character value because of the single quote. The ASCII code of lowecase x is 120. Thus, 120*3 = 360 You should be doing x*3 to get 9 without quote.
1st Nov 2018, 2:22 PM
Niush
Niush - avatar