Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("********************************")
- print(" Programador Jose Carlos Mendoza")
- print(" Fecha 20/10/2017 ")
- print(" Programa convertir a Romano ")
- print("********************************")
- u= int
- d= int
- c= int
- uni = ""
- dec = ""
- cen = ""
- def unidades(uni):
- if u==1:
- uni= "I"
- elif u==2:
- uni="II"
- elif u==3:
- uni="III"
- elif u==4:
- uni="IV"
- elif u==5:
- uni="V"
- elif u==6:
- uni="VI"
- elif u==7:
- uni="VII"
- elif u==8:
- uni="VIII"
- elif u==9:
- uni="IX"
- return uni
- def decenas (dec):
- if d==1:
- dec= "X"
- elif d==2:
- dec= "XX"
- elif d==3:
- dec= "XXX"
- elif d==4:
- dec= "XL"
- elif d==5:
- dec= "L"
- elif d==6:
- dec= "LX"
- elif d==7:
- dec= "LXX"
- elif d==8:
- dec="LXXX"
- elif d==9:
- dec="XC"
- return dec
- def centenas (cen):
- if c==1:
- cen= "C"
- elif c==2:
- cen= "CC"
- elif c==3:
- cen= "CCC"
- elif c==4:
- cen= "CD"
- elif c==5:
- cen= "D"
- elif c==6:
- cen= "DC"
- elif c==7:
- cen= "DCC"
- elif c==8:
- cen= "DCCC"
- elif c==9:
- cen= "CM"
- return cen
- i= int(input("Ingrese Numero:"))
- u=int (i)%10
- i= int (i)/10
- d=int (i)%10
- i= int (i)/10
- c=int (i)%10
- print("El Nuemro Romano es:"+" "+centenas(cen)+""+decenas(dec)+""+unidades(uni))
Add Comment
Please, Sign In to add comment