1. Homepage
  2. Homework
  3. UM-SJTU VG101 22SU - Homework2 - Number Translator

UM-SJTU VG101 22SU - Homework2 - Number Translator

Engage in a Conversation
This question has been solved

Problem 4

Write a script to read the number (input argument, less than 999,999,999) into words, e.g. 452 should be read as "four hundred and fifty two". CourseNana.COM

Requirement: CourseNana.COM

·       Do not print hyphen ' - ', CourseNana.COM

·       Write " one hundred " instead of " a hundred ", CourseNana.COM

·       Add " and " after every hundred unit, even when it is zero, but unless it is followed by two zeros CourseNana.COM

Examples: CourseNana.COM

# example 1 CourseNana.COM

Input: 200 CourseNana.COM

Output: two hundred CourseNana.COM

# example 2 CourseNana.COM

Input: 221 CourseNana.COM

Output: two hundred and twenty one CourseNana.COM

# example 3 CourseNana.COM

Input: 1002 CourseNana.COM

Output: one thousand and two CourseNana.COM

Get in Touch with Our Experts

WeChat (微信) WeChat (微信)
Whatsapp WhatsApp
Matlab代写,Matlab代编,Matlab代考,Matlabhelp,Matlab作业代写,Matlab编程代写,Matlabprogramming help,Matlabassignment help,Matlabsolution,