Compiling error

in devC++ compiler code is working fine but in this online Compiler some random number is added to my output
my code is
#include
#include<bits/stdc++.h>
using namespace std;
int n,rem,rev;
int arr[50];
main()
{
cin>>n;
while(n!=0)
{
rem=n%8;
n=n/8;
rev=rev10+rem;
}
cout<<rev<<endl;
int n2,rev2;
while(rev!=0)
{
n2=rev%10;
rev=rev/10;
rev2=rev2
10+n2;
}
cout<<rev2;

}

@tharun Initialize value of rev and rev2 to 0 and then check.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.