i wanted to know how to convert numbers 1-2000 into roman numerals.

i started out on this code but cant figure the rest of it.. can you please help me :C

#include<iostream.h> #include<conio.h> int main() {clrscr (); int r; cout<<"roman numerals 1- 2000"; cout<<endl; for(r=1; r<=2000;r++)

i was trying to make it loop to 2000 and convert each number to its roman numeral, but i cant get the right logic and program to convert it to the right roman numerals.

i tried this logic

if (r>=1000) {cout<<"M"; n=n-1000; } if else (r>=1000) {cout<<"M"; n=n-1000; } if else (r>=500) {cout<<"D"; n=n-500; } etc...

but i forgot about the numbers 999 or 90 because if i used my own logic, it would display number 1900 to MDCC, which is wrong because it's supposed to be CM. please help me

*** MOD EDIT: Fixed code tags ***