get the first digit of number c# code example
Example 1: on in get first two digit start with two numbers c#
while (number >= 10)
number /= 10;
Example 2: on in get first two digit start with two numbers c#
public static int GetFirstDigitLoop(int number)
{
while (number >= 10)
{
number = (number - (number % 10)) / 10;
}
return number;
}