answersLogoWhite

0

Function dec2rom(dec As Integer) As String

dec2rom = ""

While dec >= 1000

dec2rom += "M"

dec -= 1000

End While

If dec >= 900 Then

dec2rom += "CM"

dec -= 900

End If

If dec >= 500 Then

dec2rom += "D"

dec -= 500

End If

If dec >= 400 Then

dec2rom += "CD"

dec -= 400

End If

While dec >= 100

dec2rom += "C"

dec -= 100

End While

If dec >= 90 Then

dec2rom += "XC"

dec -= 90

End If

If dec >= 50 Then

dec2rom += "L"

dec -= 50

End If

If dec >= 40 Then

dec2rom += "XL"

dec -= 40

End If

While dec >= 10

dec2rom += "X"

dec -= 10

End While

If dec >= 9 Then

dec2rom += "IX"

dec -= 9

End If

If dec >= 5 Then

dec2rom += "V"

dec -= 5

End If

If dec >= 4 Then

dec2rom += "IV"

dec -= 4

End If

While dec

dec2rom += "I"

dec -= 1

End While

End Function

Sub Main()

Dim year = 1999

Console.Write("The year ")

Console.Write(year)

Console.Write(" in Roman numerals is ")

Console.Write(dec2rom(year))

Console.WriteLine()

End Sub

User Avatar

Wiki User

10y ago

What else can I help you with?

Related Questions

How do you create a program in visual basic?

arrays programms in visual basic


Information on Roman and Hindu - Arabic - numerals?

Basic symbols for Roman numerals I,X,l,D,M Roman numeral doesn't have 0 but hindu Arabic does


Why visual basic is referred to as a tool?

Visual Basic is a computer programming language that can be used to create programs, but it is not a program in itself.


What is visual basic generally?

Visual Basic is a computer development program. It's used to create .exe or executable programs.


What program can create with visual basic 6.0?

You can create anything you set your mind to.


What is visual basic 2008?

Visual Basic create windows form applications. They are things like your Web Browser, e.g. Internet Explorer.


Different types of number system?

the roman numerals and the Hindu Arabic are the 2 basic types of number systems but we use the Hindu Arabic


What is the history of Visual Basic 6.0?

Visual Basic was first released in 1992 Visual Basic was first released in 1998. This version included the ability to create web-based applications. Support for this version ended in 2005.


Is visual basics only available in Microsoft Excel?

No, Visual Basic is a program on its own too, used to create programs. VBA is used in Excel and other programs (Visual Basic for Applications).


What are the basic symbols of Hindu Arabic numeral system and roman numeral system?

Hindu-Arabic basic numeral symbols are: 0 1 2 3 4 5 6 7 8 and 9 Roman basic numeral symbols are: I V X L C D and M


What is visual basic control?

Visual Basic Controls work on Visual Studio for Visual Basic and Applications that made by Visual Basic.


What are Hindu Arabic numerical system and roman system What are the basic symbols used?

The basic symbols are I,X,L,C,D&M