Output is right but no test case is passed;

#include
using namespace std;

long long int octal(int n){
int sum = 0;
while(n>0){
int temp = n%8;

    sum = sum*10+temp;
    n = n/8;
 }
 return sum;

}

int main(){
long long int n;
cin>>n;
int ans = octal(n);
cout<<ans;

 return 0;

}
//here is code for converting decimal to octal

hey Ankush, your code is wrong. it prints the reverse number
for input 15 the output should be 17 but your code gives me output 71