Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Auto-generated code below aims at helping you parse
- * the standard input according to the problem statement.
- **/
- const y = parseInt(readline());
- r = ""
- let neg = false;
- if(y == 0)
- console.log("INVALID");
- else
- {
- if(y > 0)
- x = Math.ceil(y/100)
- else
- {
- x = Math.ceil(Math.abs(y/100));
- neg = true;
- }
- r += x;
- if(x%10 == 1)
- r+="st";
- else if(x%10 == 2)
- r+="nd";
- else if(x%10 == 3)
- r+="rd";
- else
- r+="th";
- r+=" century ";
- if(neg)
- r+= "B";
- r+="CE";
- console.log(r);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement