Convert.Toint32(Console.ReadLine()) does not working

showing that it doesn't exists


7/5/2016 4:56:09 AM

Shadab Khan

5 Answers

New Answer


Do you have it like this? int test; test = Convert.ToInt32(Console.ReadLine()); And don't forget that C# is case sensitive.


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


int.TryParse(Console.ReadLine(), out a); would prevent the program from (sometimes) crashing when the user inputs a non-integer value.


this code just don't ask for the second input


I'll show you