# Decimal To Roman Numeral Converter in Delphi

Email
 Submitted on: 9/9/2016 10:58:49 AM By: Jake R. Pomperada Level: Beginner User Rating: Unrated Compatibility: Delphi 6 Views: 4176

In this article I would like to share with you a sample program that I wrote using Delphi version 6 as my programming language that will ask the user to give a number and then our program will convert the given decimal number by our user into roman numerals. The code is very short and easy to understand in Delphi. Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com. My mobile number here in the Philippines is 09173084360.

code:
Can't Copy and Paste this?
 ``` !************************************** ! Name: Decimal To Roman Numeral Converter in Delphi ! Description:In this article I would like to share with you a sample program that I wrote using Delphi version 6 as my programming language that will ask the user to give a number and then our program will convert the given decimal number by our user into roman numerals. The code is very short and easy to understand in Delphi. Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com. My mobile number here in the Philippines is 09173084360. ! By: Jake R. Pomperada !************************************** unit romans; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Label1: TLabel; Label2: TLabel; Label3: TLabel; Label4: TLabel; Edit1: TEdit; Button1: TButton; Label5: TLabel; Button2: TButton; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {\$R *.dfm} function DecToRoman(Decimal: Longint): string; const Numbers: array[1..13] of Integer = (1, 4, 5, 9, 10, 40, 50, 90, 100, 400, 500, 900, 1000); Romans: array[1..13] of string = ('I', 'IV', 'V', 'IX', 'X', 'XL', 'L', 'XC', 'C', 'CD', 'D', 'CM', 'M'); var i: Integer; begin Result := ''; for i := 13 downto 1 do while (Decimal >= Numbers[i]) do begin Decimal := Decimal - Numbers[i]; Result := Result + Romans[i]; end; end; procedure TForm1.Button1Click(Sender: TObject); begin Label5.Caption:= 'The equivalent value of ' + Edit1.Text + ' to Roman Numberal is ' + DecToRoman(StrToInt(Edit1.Text))+'.'; end; procedure TForm1.Button2Click(Sender: TObject); begin Edit1.text :=''; Label5.Caption := ''; Edit1.SetFocus end; end.```

Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)