1 solutions
-
0
C :
#include<stdlib.h> #include<stdio.h> void mole(int a,int b) {if(a/b==0)printf("%d",a%b); else {mole(a/b,b);printf("%d",a%b);} } int main() { int x; scanf("%d",&x); mole(x,8); return 0;}
C++ :
#include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> using namespace std; void dg(int); int main() { int n; cin>>n; dg(n); cout<<endl; return 0; } void dg(int i) { int j,k; j = i % 8; k = i / 8; if (k != 0) dg(k); cout<<j; }
Pascal :
program pyy; var a:integer; procedure to8(n:integer); begin if n>=1 then to8(n div 8) else exit; write(n mod 8); end; begin readln(a); to8(a); readln; end.
- 1
Information
- ID
- 630
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- 10
- Tags
- # Submissions
- 6
- Accepted
- 3
- Uploaded By