Skip to content

Latest commit

 

History

History
 
 

02_09_arabic_roman

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

02_09_arabic_roman

Description

2999 = MMCMXCIX

Algorithm

  • Read the number as an integer (the number has to be between 1000 and 3000): e.g. 2786 (this is mandatory)
  • Use arithmetics to separate each digit into separate ints: (do you know what the modulus operator is? “%” No? look it up.)
  • Declare a string variable named roman. Initialize this variable to and empty string: ""
  • Use four switch cases to append the appropriate string to your roman string. 
    • roman += "XX";  //in case of tens being 2
    • roman += "XXX" // in case of tens being 3
    • etc.
  • Print the roman string after the four switches.