+ 4
Please tell me guys. Why do we have to convert an int to a string in c# in these type of situations?
static void Main(string [ ] args) { int mark; mark = Convert.ToInt32(Console.Readline());
5 Answers
+ 6
@AndreasK thank u š
+ 2
The console.Readline() method reads the line and returns the lines value as String. This is why you have to convert the return value to an integer if you want to store it in one.
+ 1
int is value type &
string is a reference type
convert value type to reference type go 2 incompatible data conversion
string smarks=Convert.Tostring(marks);
+ 1
Doesnāt C# have promotion? Just print it with marks+āā
0
string smarks=Convert.Tostring(marks);