is there's something wrong with my code below?
using System;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int num1 = 0, num2 = 0, rslt = 0;
char oprtr;
Console.Write("Enter calculation: ");
num1 = Convert.ToInt32(Console.Read());
oprtr = Console.ReadKey().KeyChar;
num2 = Convert.ToInt32(Console.Read());
switch (oprtr)
{
case '+':
rslt = num1 + num2;
break;
case '-':
rslt = num1 - num2;
break;
case '*':
rslt = num1 * num2;
break;
case '/':
rslt = num1 / num2;
break;
default:
break;
}
Console.Write("rslt: {0}", rslt);
Console.WriteLine();
Console.ReadKey();
return;
}
}
}
after i compile and run it, the result is 0
it looks like there's nothing wrong with my code.
don't know what's wrong with my code