**Tell us what’s happening:**

Perhaps I did this different than was wanted but I’m getting the right answers but its telling me I’m getting them all wrong except for convertToRoman(4) which for some reason changes from red to green and back depending on what number I put in to the program.

**Your code so far**

```
function numOfX(num, string){
for(var i =0; i<num; i++){
total+=string;
}
}
function convertToRoman(num) {
numOfX(Math.floor(num/1000), "M");
num= num%1000;
if(num>=900){
total+="CM";
num -= 900;
}
numOfX(Math.floor(num/500), "D");
num= num%500;
if(num>=400){
total+="CD";
num -= 400;
}
numOfX(Math.floor(num/100), "C");
num= num%100;
if(num>=90){
total+="XC";
num -= 90;
}
numOfX(Math.floor(num/50), "L");
num= num%50;
if(num>=40){
total+="XL";
num -= 40;
}
numOfX(Math.floor(num/10), "X");
num= num%10;
if(num>=9){
total+="IX";
num -= 9;
}
numOfX(Math.floor(num/5), "V");
num= num%5;
if(num>=4){
total+="IV";
num -= 4;
}
numOfX(Math.floor(num/1), "I");
return total;
}
convertToRoman(4);
```

**Your browser information:**

Your Browser User Agent is: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36`

.

**Link to the challenge:**