0
Convert.Toint32(Console.ReadLine()) does not working
showing that it doesn't exists
5 Answers
+ 1
Do you have it like this?
int test;
test = Convert.ToInt32(Console.ReadLine());
And don't forget that C# is case sensitive.
0
namespace SoloLearn
{
class Program de
{
int a,b,c;
void add()
{
Console.WriteLine("input the 1st value");
a=Convert.ToInt32(Console.ReadLine());
Console.WriteLine("input the 2nd value");
b=Convert.ToInt32(Console.ReadLine());
c =a*b;
Console.WriteLine("result ="+ c);
}
static void Main(string[] args)
{
Program q= new Program();
q.add();
Console.ReadLine();
}
}
}
showing an unhanded exception
0
int.TryParse(Console.ReadLine(), out a); would prevent the program from (sometimes) crashing when the user inputs a non-integer value.
- 1
this code just don't ask for the second input
- 1
I'll show you