FEST05 - Editorial

Problem Link:
CONTEST
PRACTICE

Author- Virender Yadav

Tester- Vipin Khushu

Editorialist- Virender Yadav

Difficulty:
Simple

Prerequisites:
Easy

Problem:
Our task is to convert numeric number into English numbers.

Explanation:
First take string ret to save the answer.
Get the first and last digit from given number.
Check if first digit(10th place) is greter than 1 or equal to 1 or not equal to 1.
if it is greter than 1 means it is between 20 to 99 , check if first digit(10th place) is equal to 2 then add “twenty” to string ret, else if first digit(10th place) is equal to 3 then add “thirty” to string ret and so on till 9 , nand also add “-” if the second digit(1th place) is not equal to 0.
else if first digit(10th place) is equal to 1 mean it is between 10 to 19 , check if first digit(10th place) is equal to 1 then add “eleven” to string ret, else if first digit(10th place) is equal to 2 then add “twelve” to string ret and so on till 9.
else if first digit(10th place) is not equal to 1 mean it is between 0-9 and 20-99 , As first digit is alredy converted to english now we have to convert only second digit and as between 11 to 19 the second digit also converted so we dont need them , check if second digit(1th place) is equal to 0 then add “zero” to string ret, else if second digit is equal to 1 add “one” to string ret.
now print string ret

Solution
http://ideone.com/xPqhpL