Created
January 19, 2014 19:55
-
-
Save LESTADru/8510156 to your computer and use it in GitHub Desktop.
function getPow x v stepeni n;
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title></title> | |
</head> | |
<body> | |
<script> | |
function getPow(x, n){ | |
var result = x; | |
for(var i=1;i<n;i++){ | |
result = result*x; | |
} | |
return result; | |
} | |
var x= +prompt('x?', ''); | |
var n= +prompt('n?', ''); | |
if (n <= 1){ | |
alert('Степень ' + n + ' не поддерживается, введите целую степень, большую 1'); | |
}else { | |
alert(getPow(x, n)); | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment