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 151 views
1 answer 169 views
1 answer 179 views
2 answers 205 views
1 answer 172 views
4 answers 305 views
2 answers 311 views
...