#t321. 十进制转换成八进制(change)

十进制转换成八进制(change)

Decimal to Octal Conversion (change)

Problem Background

Special for beginners, ^_^

Problem Description

Using a recursive algorithm, convert any given positive decimal integer into octal and output it.

Input Format

Input a non-negative integer, the decimal number to be converted.

Output Format

Output a non-negative integer, the converted octal number.

Sample Input

15

Sample Output

17

Constraints

Time limit: 1s, memory limit: 1024KiB for each test case.

All data are within the range of int.

Hint

  1. printf("%o", x);
  2. cout << oct << x;
void print(int x) {
    if (x < 8) {
        printf("%d", x);
        return;
    }
    print(x / 8);
    printf("%d", x % 8);
}