get fitst digit of number c# code example
Example 1: 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;
}
Example 2: on in get first two digit start with two numbers c#
int firstDigit = (int)(Value.ToString()[0]) - 48;