|
I need some help
I am trying to make power calculator
real number is X and index is Y in this case
this is how i started
<!--
var x, y, result
x = prompt("input X")
y = promt("input Y")
for(¨è) {
result = ¨é
}
document.write("<H3> Answer : " + ¨ê + "</H3>")
-->
so what should I put in ¨è, ¨é, ¨ê?
If x is 2 and y is 3, then the screen should show like:
Answer: 8
can someone give me any help/idea?
there may be something to correct in the code i wrote. I am not sure
but I think I am on the right track but I just cant go further
|
|
|
Try this piece of code
for (i=1; i <= y; i++)
{
result = result * x;
}
display your result in the output within your H3 tag
ensure you initiate the value of the variable result to 1 before the for loop
|
|
|
|
|
|
|
|