1

これをどのように進めればよいかまったくわかりません。そのため、SSCCE を作成できませんでした。

銀行に預金された金額を 100、50、20、10、5、2、1 の単位で表示する JavaScript を書きたいと思います。

例: Rs.163 を入金した場合、出力は 1-100、1-50、1-10、1-2、1-1 になります。

これで私を助けてください...

4

2 に答える 2

0
<html>
<head><title>Display the Denomination</title></head>
<body><script>
a=prompt("Enter number"," ");
n=parseInt(a);
h=Math.floor(n/100);
n=n-h*100;
f=Math.floor(n/50);
n=n-f*50;
tw=Math.floor(n/20);
n=n-tw*20;
t=Math.floor(n/10);
n=n-t*10;
fi=Math.floor(n/5);
n=n-fi*5;
two=Math.floor(n/2);
n=n-two*2;
one=Math.floor(n/1);
document.write("Hundreds="+h+"<br>Fifties="+f+"<br>Twenties="+tw+"<br>Tens="+t+"<br>Fives="+fi+"<br>Twos="+two+"<br>Ones="+one);
</script>
</body></html>
于 2015-11-28T04:44:07.560 に答える