Skip to content

a method called numberToWords with one int parameter named number. The method should print out the passed number using words for the digits. If the number is negative, print "Invalid Value". To print the number as words, follow these steps: Extract the last digit of the given number using the remainder operator. Convert the value of the digit f…

Notifications You must be signed in to change notification settings

Avinashkr1229/NumberToWord

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Number_To_Word

Write a method called numberToWords with one int parameter named number.

The method should print out the passed number using words for the digits.

If the number is negative, print "Invalid Value".

To print the number as words, follow these steps:

  1. Extract the last digit of the given number using the remainder operator.
  2. Convert the value of the digit found in Step 1 into a word. There are 10 possible values for that digit, those being 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. Print the corresponding word for each digit, e.g. print "Zero" if the digit is 0, "One" if the digit is 1, and so on.
  3. Remove the last digit from the number.
  4. Repeat Steps 2 through 4 until the number is 0.

About

a method called numberToWords with one int parameter named number. The method should print out the passed number using words for the digits. If the number is negative, print "Invalid Value". To print the number as words, follow these steps: Extract the last digit of the given number using the remainder operator. Convert the value of the digit f…

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 78.7%
  • Python 21.3%