human
Converting Decimal Number lying between 1 to 3999 to Roman Numerals | Function to calculate roman equivalent.
Storing roman values of digits from 0 - 9 when placed at different places.
Converting to roman.
Driver code"
Solution in Python:
assistant
#Here is code to converting Decimal Number lying between 1 to 3999 to Roman Numerals and the other steps required.
 def intToRoman ( num ) :
	m = [ " " , " M " , " MM " , " MMM " ]
	c = [ " " , " C " , " CC " , " CCC " , " CD " , " D " , " DC " , " DCC " , " DCCC " , " CM ▁ " ]
	x = [ " " , " X " , " XX " , " XXX " , " XL " , " L " , " LX " , " LXX " , " LXXX " , " XC " ]
	i = [ " " , " I " , " II " , " III " , " IV " , " V " , " VI " , " VII " , " VIII " , " IX " ]
	thousands = m [ num // 1000 ]
	hundereds = c [ ( num % 1000 ) // 100 ]
	tens = x [ ( num % 100 ) // 10 ]
	ones = i [ num % 10 ]
	ans = ( thousands + hundereds + tens + ones )
	return ans
if __name__ == " _ _ main _ _ " :
	number = 3549
	print ( intToRoman ( number ) )