5/22/2022 9:57:55 AM
Иван Литовченко , the variable x is string, so the operation is string concatenation => "10" + 1 => "101". You can declare x as int => int x =int.Parse(Console.ReadLine ()).
Иван Литовченко , you didn't assign it to a variable => int y = Convert.ToInt32 (x);
But I wrote Convert.Toint32, he had to convert x to int ?
int x = Convert.ToInt32(Console.ReadLine());
static void Main(string args)
int x = int.Parse(Console.ReadLine());
Instead of making x a string make it a int
Get the input from user , since its a string type cast it to a int with the int.Parse() method .
String concatenation is happening when u are printing the results with the + 1 which is why when u enter 10 printts out the 1 appended to it
instead add the one before print statement
Console.WriteLine (Convert.ToInt32 (x) + 1);
SoloProg ,And separately the convert.tu command without inserting it into any method cannot be obtained?
Send us a message