For this Question: Given a number N, your task is to convert the number into a single digit by repeatedly replacing the number N with its sum of digits until the number becomes a single digit.The input contains a single integer N.

Constraints:-
1 <= N <= 100000Print the single digit after performing the given operation.Sample Input:-
987

Sample Output:-
6

Explanation:-
987 - > 9 + 8 + 7 => 24 = 2 + 4 => 6

Sample Input:-
91

Sample Output:-
1, I have written this Solution Code: import java.io.*;
import java.util.*;



class Main {
	public static void main (String[] args) throws IOException{
        BufferedReader br = new BufferedReader(
            new InputStreamReader(System.in)
        );

        int n = Integer.parseInt(br.readLine());
        int sum =0;
        while(sum>9 || n>0){
             if (n == 0) {
                n = sum;
                sum = 0;
            }
            sum += n%10;
            n /= 10;
        }
        System.out.println(sum);
	}
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?