Convert a Number to Words

Given an integer number num, your task is to convert 'num' into its corresponding word representation.

Input:

The first line of input contains an integer ‘T’ denoting the number of test cases.
Each of the next ‘T’ lines contains a single integer ‘num’.

Output:

For each test case, return a string or character array that represents the word form of the given number ‘num’.
Example:
Input: num = 9823
Output: "nine thousand eight hundred twenty three"

Constraints:

  • 1 <= T <= 10^5
  • 0 <= num <= 9999
  • Time limit: 1 sec

Note:

1. In every two consecutive words, there must be a space.
2. All the characters of the word must be English lowercase letters.
3. The return type must be a string.
4. You are not required to print the output explicitly, it has already been taken care of. Just implement the function and return the word.
AnswerBot
11d

Convert a given integer number into its corresponding word representation.

  • Implement a function that takes an integer as input and returns the word representation of that number.

  • Break down the number i...read more

Help your peers!
Add answer anonymously...
Clearwater Analytics Software Developer 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