Doubt regarding code for decimal to octal

The code is working in sublime + PowerShell but here it is not giving any output
Code is:

#include
#include
using namespace std;
int main()
{
int input,ans,i=0;
cin>>input;
ans=0;
while(input!=0)
{

ans=input%8+ans*10;
if(input%8==0)
	i++;
else 
{
  ans*=pow(10,i);
  i=0;
}
 input/=8;

}
cout<<ans;
return 0;
}

Maybe because of your intenet connection.Could you please add the question link. Also for various testcases your code doesn’t give right answer.

I think there is some problem with ide it is on the grp. Thanks anyways.

Hey Sonali, your code is not correct it will not give the correct output, check for this case
input:
12
your code’s output:
41
but the expected output is:
14

I found that there is an error but output is not showing

Hey Sonali, you can check it on online ide, there is compilation or run timr error but the output printed is not correct.