+ 1
How to convert the last digit in a number into a string??
4356 👉 six
2 Respostas
+ 2
You can convert the entire number into a string and then get the last character of that string and convert it back to a string. You didn't specify a language so all I can give is a general explanation that will work with most languages.
4356 -> "4356" -> '6' -> "6"
+ 1
Now that you have specified C# as the language:
class Program
{
static void Main()
{
int myInt = 4356;
String x = myInt.ToString().Substring(myInt.ToString().Length-1);
Console.WriteLine(x);
}
}