How to remove the last digit from an integer in Java

1 Answer

0 votes
class Main {
    public static void main(String[] args) {
        int number = 8405796; 
        
        number = number / 10; // Removes the last digit
        
        System.out.println(number); 
    }
}


/*
run:

840579

*/

 



answered Jul 30, 2025 by avibootz

Related questions

...