https://ide.codingblocks.com/s/94739 please kindly check this code
Decimal to octal problem
i dont know whats wrong in this code
@Ayushi21 hey ayushi try this approach
#include< iostream >
using namespace std;
int main(){
int n;cin>>n;
int ans=0;int p=1;
for( ;n>0;n=n/8){
int last_digit=n%8;
ans=ans+last_digit * p;
p=p * 10;
}
cout<<ans<<endl;
}
please check my code for this problem