Find the remainder when First digit of a number is divided by its Last digit | Java program to find the remainder when the First digit of a number is divided by its Last digit ; Function to find the remainder ; Get the last digit ; Get the first digit ; Compute the remainder ; Driver code
class GFG { static void findRemainder ( int n ) { int l = n % 10 ; while ( n >= 10 ) n /= 10 ; int f = n ; int remainder = f % l ; System . out . println ( remainder ) ; } public static void main ( String [ ] args ) { int n = 5223 ; findRemainder ( n ) ; } }