Guest User

Untitled

a guest
Oct 21st, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. print("********************************")
  2. print(" Programador Jose Carlos Mendoza")
  3. print(" Fecha 20/10/2017 ")
  4. print(" Programa convertir a Romano ")
  5. print("********************************")
  6. u= int
  7. d= int
  8. c= int
  9. uni = ""
  10. dec = ""
  11. cen = ""
  12. def unidades(uni):
  13.  
  14. if u==1:
  15. uni= "I"
  16. elif u==2:
  17. uni="II"
  18. elif u==3:
  19. uni="III"
  20. elif u==4:
  21. uni="IV"
  22. elif u==5:
  23. uni="V"
  24. elif u==6:
  25. uni="VI"
  26. elif u==7:
  27. uni="VII"
  28. elif u==8:
  29. uni="VIII"
  30. elif u==9:
  31. uni="IX"
  32. return uni
  33.  
  34. def decenas (dec):
  35.  
  36. if d==1:
  37. dec= "X"
  38. elif d==2:
  39. dec= "XX"
  40. elif d==3:
  41. dec= "XXX"
  42. elif d==4:
  43. dec= "XL"
  44. elif d==5:
  45. dec= "L"
  46. elif d==6:
  47. dec= "LX"
  48. elif d==7:
  49. dec= "LXX"
  50. elif d==8:
  51. dec="LXXX"
  52. elif d==9:
  53. dec="XC"
  54. return dec
  55.  
  56. def centenas (cen):
  57. if c==1:
  58. cen= "C"
  59. elif c==2:
  60. cen= "CC"
  61. elif c==3:
  62. cen= "CCC"
  63. elif c==4:
  64. cen= "CD"
  65. elif c==5:
  66. cen= "D"
  67. elif c==6:
  68. cen= "DC"
  69. elif c==7:
  70. cen= "DCC"
  71. elif c==8:
  72. cen= "DCCC"
  73. elif c==9:
  74. cen= "CM"
  75. return cen
  76.  
  77.  
  78. i= int(input("Ingrese Numero:"))
  79. u=int (i)%10
  80. i= int (i)/10
  81. d=int (i)%10
  82. i= int (i)/10
  83. c=int (i)%10
  84.  
  85. print("El Nuemro Romano es:"+" "+centenas(cen)+""+decenas(dec)+""+unidades(uni))
Add Comment
Please, Sign In to add comment