0

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

showing that it doesn't exists

c#

7/5/2016 4:56:09 AM

Shadab Khan

5 Answers

New Answer

+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