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.

AnswerBot
4mo

Convert decimal numbers to octal representation.

  • Iterate through each test case and use built-in functions to convert decimal to octal.

  • Ensure the output is in base-8 system with digits ranging from 0 t...read more

Help your peers!
Select
Add answer anonymously...

Top Software Engineer Interview Questions Asked at Societe Generale Global Solution Centre

Q. What is a nested query in SQL, and how can it be combined with joins?
Q. What are the main concepts of Object-Oriented Programming (OOP) in Java?
Q. What can you explain about the use of annotations in Spring Boot?
Software Engineer Interview Questions
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+

Reviews

10L+

Interviews

4 Cr+

Salaries

1.5 Cr+

Users

Contribute to help millions

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

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits