我试着做一个乘数。当我插入数字5时,奇迹般地变为53.当数字2时,它将是50.看不到我犯了一个错误。我的输入值不是我插入的数字
public static void Main(string[] args)
{
Console.WriteLine("Enter the number: ");
int num = Console.Read();
Console.WriteLine();
int i;
for (i = 0; i <= 10; i++)
{
int result = num * i;
Console.WriteLine("{0}*{1}={2}", num, i, result);
}
}
变化'INT NUM = Console.Read();''到INT NUM = Convert.ToInt32(到Console.ReadLine());' – Equalsk
及其与'的5 –
整数转换ASCII等同放着清单值Console.ReadLine'在这里工作正常:https://dotnetfiddle.net/UxbT5O。 –