How to delete the first digit from a number in C#

1 Answer

0 votes
using System;

class Program
{
    static void Main() {
        int n = 853271;
     
        Console.WriteLine((int)Math.Log10(n));
        Console.WriteLine((int)Math.Pow(10, (int)Math.Log10(n)));
           
        n = n % (int)Math.Pow(10, (int)Math.Log10(n));

        Console.WriteLine(n);
    }
}


/*
run:

5
100000
53271

*/

 



answered Jun 5, 2020 by avibootz

Related questions

1 answer 140 views
1 answer 159 views
1 answer 162 views
2 answers 187 views
1 answer 161 views
4 answers 276 views
2 answers 297 views
...