<script language="JavaScript> x = prompt("Please enter a number"); answer = x % 72 alert("The answer is " answer) <script>
<script> document.write("There was an old woman "); document.write("who lived in a shoe.<p />"); document.write("She had so many children, "); document.write("she didn't know what to do.<p />"); document.write("But then they grew up "); document.write("and she had no-one to handle.<p />"); document.write("So the old woman moved out ...<p />"); document.write("... and into a sandal!"); </script>
<script language="JavaScript"> var x = 2; // x = 7; alert(x); </script> |
The number displayed is
|
Write a program that uses prompt() twice, once to enter the weight in stone and then again to enter the remaining pounds (i.e. to enter a weight of 14 stone and 12 pounds, '14' would be entered the first time, and '3' the second time), and then displays the weight in kilogrammes.
I am grossly overweight, and as part of a strict diet I weigh myself once a week. I have two weighing scales - one weighs in stone and pounds and the other in kilogrammes. Unfortunately, I don't know which of the two is more accurate, and I have no way of calibrating them, so I weigh myself on each and then take an average of the two weights. Write a version of your previous program that allows me to enter both weights and then returns the average weight in kilogrammes.