0
How to read numbers?
How to read numbers? Code: int x; x = Console.Read(); //Here we insert 1. Console.WriteLine("x ={0}",x); Why the Input is 49?
2 Answers
+ 2
Try
x=int.Parse(Console.ReadLine());
C# input takes input as string to convert string to int use int.Parse
Try THis
For More details Check This
https://www.tutorialsteacher.com/articles/convert-string-to-int
https://www.geeksforgeeks.org/different-ways-to-convert-string-to-integer-in-c-sharp/
https://softwareengineering.stackexchange.com/questions/291581/integer-conversion-with-console-readline
+ 1
Thanks Ashraf, but I search a new solution for my answer:
*Int* = Convert.ToInt32(*The string*)