public class Charest
{
public static void Main(string []args)
{
int ch1, ch2;ch1 = 65;
ch2 = 'B';
Console.WriteLine(ch1+' '+ch1);
}
}
How is it 164?
it should be 65+65 =130 right?
Space has a value of 32 so when you add up the ch1 and ch1 along with space, you get 162.
int a, b;
a = 65;
b = 'B'; // Decimal / Integer Value = 66
Console.WriteLine(a + ' ' + a);
Console.WriteLine(a + ' ' + b);
Console.WriteLine(a + b);
Console.WriteLine(0 + ' ');
// Prints
162
163
131
32
ASCII table for reference to characters and their decimal values.
It should be 162 not 165. Space value is 32. So Sum is 65 + 32 + 65 = 162
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.