Decimal to octal

sir mere code m galat kya hai
#include
using namespace std;

int main()
{
long long int n;
cin>>n;
long long int rev=0;
while(n!=0)
{
long long int x=n%8;
rev=rev*10+x;
n=n/8;
}
cout<<rev;
return 0;
}

u were calculating the answer in a wrong way

sir mera code compile bilkul sahi karta hai magar test case m nahi sahi ho raha

ha like since the logic u are applying to calculate the octal value id wrong hence u are getting WA in the test case
please check out my code