题目:阿拉伯数字转罗马数字
1.JavaScript实现
function convert(num) {
var aArray = [1000,900,500,400,100,90,50,40,10,9,5,4,1];
var rArray = ["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"];
var str = "";
for(var i = 0; i < aArray.length; i++){
while(num >= aArray[i]){
str += rArray[i];
num -= aArray[i];
}
}
console.log(str);
return str;
}
convert(36);
2.Java实现,
参考http://blog.csdn.net/fightforyourdream/article/details/12934139#
package Linkedin;
public class RomeToArabic {
public static void main(