Please help how do I convert int to string. For example
int num = 9;
Console.WriteLine(num.ToString("X"));
Will display
9
Expected Output:
9 = nine
Please help how do I convert int to string. For example
int num = 9;
Console.WriteLine(num.ToString("X"));
Will display
9
Expected Output:
9 = nine
So you want to write "nine" not "9"?
In the former case you'll have to use a selection statement, preferably switch/case.
eg
int num = 9
string stringNum;
switch (num)
{
case 9:
stringNum = "nine";
break;
}
In the latter case, you can just print the integer.
Console.WriteLine(num);