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: #include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    while(n>9){
        int p = n;
        int sum=0;
        while(p>0){
            sum+=p%10;
            p/=10;
            
        }
        n=sum;
    }
    cout<<n;
}, In this Programming Language: C++, Now tell me if this Code is compilable or not?