Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- y=int(input())
- s=''
- x=y//1000
- if (x>0 and x<4):
- s=s+x*'M'
- x=(y//100)%10
- if (x>0 and x<4):
- s=s+x*'C'
- elif x==4:
- s=s+'CD'
- elif x>4 and x<9:
- s=s+'D'+(x-5)*'C'
- elif x==9:
- s=s+'CM'
- x=(y//10)%10
- if (x>0 and x<4):
- s=s+x*'X'
- elif x==4:
- s=s+'XL'
- elif x>4 and x<9:
- s=s+'L'+(x-5)*'X'
- elif x==9:
- s=s+'XC'
- x=y%10
- if (x>0 and x<4):
- s=s+x*'I'
- elif x==4:
- s=s+'IV'
- elif x>4 and x<9:
- s=s+'V'+(x-5)*'I'
- elif x==9:
- s=s+'IX'
- print(s)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement