Answer the question
In order to leave comments, you need to log in
Why doesn't string to number conversion work?
What's wrong here?
using System;
namespace DefaultProject
{
class MainClass
{
public static void Main (string[] args)
{
string str = "100";
string str1 = Console.ReadLine ();
int x = Convert.ToInt32 (str);
Console.WriteLine (x + str1);
Console.ReadKey ();
}
}
}
Answer the question
In order to leave comments, you need to log in
string str = "100";
you turn this line into a number here int x = Convert.ToInt32(str);
, and string str1 = Console.ReadLine()
you plan to translate the line into a number? Or should it?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question