programs for integer to roman number.

I want to know what is the roman number of 49 is it XLIX or IL.I participated in computer’s fest they gave me program to convert integer to romans .I solved ,but they are saying roman number will be printing using nearest number technique of numbers.But from 3rd class i read only this.oN the internet site i saw also 49=XLIX,but they are saying 49=IL.please help me to solve this issue…

1 Like

49 is IL.

here is pseudo code for converting

const int vals[] = {1, 4, 5, 9, 10, 40, 49, 50, 100, 400, 500, 1000}

const int str[] = {I, IV, V, IX, X, XL, IL, L, C, CD, D, M}

string toRoman(int n) {

string ans;
int i = 11;
while (i >= 0) {
   while (n >= vals[i]) ans += str[i], n -= vals[i]; 
return ans;


Note: I might have missed a digit or two, but you get the gist of it. Just iterate from largest to smallest digit and subtract it from the number while you can.

Edit : didn’t include 900.

You are right, 49 is XLIX.

49 = 40 + 9 = XL + IX = XLIX

I wrote a simple code for this here.

You can find more information here.
Roman numerals were pretty much standardized, but people tend to use their own rules to generate numerals from very past.

Roman numerals are written by concatenating place values of every digit, so it should be XLIX.