Skip to content

This repository contains number-to-words conversion scripts in various programming languages.

Notifications You must be signed in to change notification settings

SuluJulianto/number-to-words-converter

Repository files navigation

Number to Words Converter

This repository contains number-to-words conversion scripts in various programming languages.

Python

Description

This Python script converts a given numerical input into its word representation. It breaks down the input number into groups of three digits, converting each group into words and concatenating them to form the complete word representation of the number.

How to Use

  1. Run the script.
  2. Input a number when prompted.
  3. The script will display the word representation of the number.

Example

Input: 123456789 Output: "one hundred twenty-three million four hundred fifty-six thousand seven hundred eighty-nine"

Limitations

  • The script can handle numbers up to 21 digits in length.
  • For input beyond 21 digits, it prompts the user to enter a number smaller than or equal to 21 digits.

JavaScript

Description

This JavaScript code converts a given numerical input into its word representation. It divides the input number into groups of three digits, converts each group into words, and concatenates them to form the complete word representation of the number.

How to Use

  1. Run the code in a JavaScript environment.
  2. Enter a number when prompted.
  3. The code will output the word representation of the number.

Example

Input: 123456789 Output: "one hundred twenty-three million four hundred fifty-six thousand seven hundred eighty-nine"

Limitations

  • This code can handle numbers up to 21 digits in length.
  • For input beyond 21 digits, it doesn't handle such cases and might need further modification.

Ruby

Description

This Ruby script performs number-to-words conversion. It segments the input number into groups of three digits, converts each segment into words, and concatenates them to create the full word representation of the number.

How to Use

  1. Run the Ruby script.
  2. Input a number as prompted.
  3. The script will display the word representation of the number.

Example

Input: 123456789 Output: "one hundred twenty-three million four hundred fifty-six thousand seven hundred eighty-nine"

Limitations

  • The script supports numbers up to 21 digits in length.
  • For numbers longer than 21 digits, it requires modification to handle such cases.

PHP

Description

This PHP script converts a given numerical input into its word representation. It segments the input number into groups of three digits, converts each segment into words, and concatenates them to create the full word representation of the number.

How to Use

  1. Run the PHP script.
  2. Input a number as prompted.
  3. The script will display the word representation of the number.

Example

Input: 123456789 Output: "one hundred twenty-three million four hundred fifty-six thousand seven hundred eighty-nine"

Limitations

  • Supports numbers up to 21 digits in length.
  • Requires modification for numbers longer than 21 digits.

C

Description

This C program converts a given numerical input into its word representation. It segments the input number into groups of three digits, converts each segment into words, and concatenates them to create the complete word representation of the number.

How to Use

  1. Compile the C code.
  2. Run the compiled program.
  3. Input a number as prompted.
  4. The program will display the word representation of the number.

Example

Input: 123456789 Output: "one hundred twenty-three million four hundred fifty-six thousand seven hundred eighty-nine"

Limitations

  • Supports numbers up to 21 digits in length.
  • Requires adjustment for numbers longer than 21 digits.

C++

Description

This C++ program converts a given numerical input into its word representation. It segments the input number into groups of three digits, converts each segment into words, and concatenates them to create the full word representation of the number.

How to Use

  1. Compile the C++ code.
  2. Run the compiled program.
  3. Input a number as prompted.
  4. The program will display the word representation of the number.

Example

Input: 123456789 Output: "one hundred twenty-three million four hundred fifty-six thousand seven hundred eighty-nine"

Limitations

  • Supports numbers up to 21 digits in length.
  • Requires modifications for numbers longer than 21 digits.

Java

Description

This Java program converts a given numerical input into its word representation. It segments the input number into groups of three digits, converts each segment into words, and concatenates them to create the complete word representation of the number.

How to Use

  1. Compile the Java code.
  2. Run the compiled program.
  3. Input a number as prompted.
  4. The program will display the word representation of the number.

Example

Input: 123456789 Output: "one hundred twenty-three million four hundred fifty-six thousand seven hundred eighty-nine"

Limitations

  • Supports numbers up to 21 digits in length.
  • Requires adjustments for numbers longer than 21 digits.

Golang

Description

This Go program converts a given numerical input into its word representation. It segments the input number into groups of three digits, converts each segment into words, and concatenates them to create the full word representation of the number.

How to Use

  1. Run the Go program.
  2. Input a number as prompted.
  3. The program will display the word representation of the number.

Example

Input: 123456789 Output: "one hundred twenty-three million four hundred fifty-six thousand seven hundred eighty-nine"

Limitations

  • Supports numbers up to 21 digits in length.
  • Requires modifications for numbers longer than 21 digits.

Feel free to explore and modify the code to suit your requirements!

About

This repository contains number-to-words conversion scripts in various programming languages.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published