fork download
  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main(){
  6. int n;
  7. while(cin>>n){
  8. string res;
  9. if(n == 0) res = "0";
  10. while(n){
  11. int t = n % 8;
  12. res += '0' + t;
  13. n /= 8;
  14. }
  15. reverse(res.begin(),res.end());
  16. cout<<res<<endl;
  17. }
  18. return 0;
  19. }
Success #stdin #stdout 0s 4372KB
stdin
7
8
16
stdout
7
10
20