?
Solved

Roman Numeral Conversion

Posted on 2000-02-14
1
Medium Priority
?
550 Views
Last Modified: 2010-05-18
I would like to use a roman numeral as my copyright year.  What is the conversion code I need to use?
0
Comment
Question by:tecmaster
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 6

Accepted Solution

by:
tecbuilder earned 1600 total points
ID: 2521389
I developed this for a pascal program I wrote quite a while ago and later converted it to JavaScript to convert any integer to Roman Numeral and Roman Numeral to integer.  I believe it will do what you want.

<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
function convertInteger(N) {
  var valRN = new Array (1,4,5,9,10,40,50,90,100,400,500,900,1000);
  var textRN = new Array ("I","IV","V","IX","X","XL","L","XC","C","CD","D","CM","M");
  var theValue = "";
  while (N > 0) {
    i = 12;
    while(valRN[i] > N) i--;
    numRN = Math.floor(N / valRN[i]);
    for (j=1;j<=numRN;j++) theValue += textRN[i];
    N = N % valRN[i];
  }
  return theValue;
}

// -->
</SCRIPT>
</HEAD>

<BODY>
<SCRIPT LANGUAGE="JavaScript">
<!--
document.write("Copyright &copy; " + convertInteger(2000));
//-->
</SCRIPT>

</BODY>
</HTML>

tec
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question