c# get the first number code example
Example 1: on in get first two digit start with two numbers c#
int firstDigit = (int)(Value / Math.Pow(10, (int)Math.Floor(Math.Log10(Value))));
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;
}