Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Roman Numeral Conversion

Posted on 2000-02-14
1
Medium Priority
?
561 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
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…

636 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