# C or C++ Program to Convert Decimal to Roman Number

This article describes C or C++ program to convert decimal number into roman number, convert from decimal to roman in C/C++. Let us discuss about decimal and roman numbering system.

Convert Decimal to Roman Number
The decimal (base ten) numeral system has ten possible values (0, 1, 2,3,4,5,6,7,8, or 9). The Roman Number system used the following ten symbols to represent 1-10
I, II, III, IV, V, VI, VII, VIII, IX, X.

C or C++ Code to Convert Decimal to Roman

```#include
#include
void main(){
clrscr();
int a;

cout<<"\" This program will convert decimal number into roman number. \""<<endl<<endl;

xx:
cout<<"What is the Decimal number ?. Give a integer number."<<endl; 	cin>>a;

if(a<0) {
cout<<"Negative number is not allow.Please give a integer number."<<endl;
goto xx;
}

cout<<endl;
cout<<"You have given decimal "<<a<<endl;
cout<<"In Roman number is : ";     while(a>=1000){
cout<<"M"; 	    a=a-1000; 	}     while(a>=500){
cout<<"D"; 	    a=a-500; 	}     while(a>=100){
cout<<"C"; 	    a=a-100; 	}     while(a>=50){
cout<<"L"; 	    a=a-50; 	}     while(a>=10){
cout<<"X"; 	    a=a-10; 	}     if((a>=5) && (a<9)){
cout<<"V";
a=a-5;
}

switch(a){
case 0 :
break;
case 1 : cout<<"I"  ;
break;
case 2 : cout<<"II" ;
break;
case 3 : cout<<"III";
break;
case 4 : cout<<"IV" ;
break;
case 9 : cout<<"IX" ;
break;
}

getch();
}```