PREVOD CISEL ARAB->RIM

ID
Nazov / Name:
Popis / Description:
Dlzka / Length:
Testovane pod / Tested under:

 

169
p169.html / p169.zip
Prevadza arabske cislice na rimske
1029b
NN 4.04, IE 4.0

UKAZKA / CLICK HERE

Zdrojovy tvar / Source code:

<HTML> <HEAD> <TITLE>JavaScript DESTINATION - P169</TITLE> <script language="JavaScript"> <!-- function initArray() { this.length=initArray.arguments.length; for (var i=0;i<this.length;i++) { this[i]=initArray.arguments[i]; } } var arr=new initArray("I","V","X","L","C","D","M"); var arn=new initArray(1,5,10,50,100,500,1000); function ArabRim(x) { s=""; for(i=6;i>=0;i--) { while(Math.floor(x/arn[i])>=1) { s+=arr[i]; x-=arn[i] } for(y=0;y<=2*Math.floor((i-1)/2);y++) { if(x/(arn[i]-arn[y])>=1) { s+=arr[y]+arr[i]; x-=arn[i]-arn[y] } } } return(s) } // --> </script> </HEAD> <BODY> <form name="formular"> Prevod arabskych cisel na rimske cisla<br> <input type="text" value="1974" name="zdroj"> <input type="button" value="Prevod" onClick="document.formular.vysledek.value=ArabRim(document.formular.zdroj.value);"> <input type="text" value="" name="vysledek"> </form> </BODY> </HTML>
[ Navrat / BACK ]