0
Sololearn bug?
So you type in 2 numbers and it’s supposed to output the first one, the second one, and then both string x = Console.ReadLine(); Console.WriteLine(x[0]); Console.WriteLine(x[1]); Console.WriteLine(x[0] + x[1]); Use 00 as example And the output is: 0 0 96 ??????????? Why does it say 96? For 12 the output is 1 2 99? What?
1 Réponse
+ 1
ITDW
That is not a bug.
ASCII value of 0 is 48 so 00 will be 48 + 48 = 96
ASCII value of 1 is 49 so 01 = 48 + 49 = 97
ASCII value of 2 is 50 so 02 = 48 + 50 = 98
and addition of ASCII value of 1 & 2 = 49 + 50 = 99
Try 01 and 02
When you take 00 as a string so here 0 will be a character so when you add 0 and 0 then ASCII value will be add which is 48 + 48 = 96