Decimal to Octal Conversion Problem Statement

Convert a given decimal number into its equivalent octal representation.

Explanation:

The octal number system is a base-8 system, meaning each digit ranges from 0 to 7.

Input:

The first line contains a single integer 'T', the number of test cases.
The next 'T' lines each contain an integer 'X', the decimal number to be converted.

Output:

Print the octal value of 'X' for each test case on a new line.

Example:

Input:
3
10
20
65
Output:
12
24
101

Constraints:

  • 1 <= T <= 105
  • 0 <= X <= 109

Note: The input/output handling is already managed. You need to implement the function logic.

Be the first one to answer
Add answer anonymously...
Societe Generale Global Solution Centre Software Engineer Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter