Created
October 3, 2013 18:28
-
-
Save magmastonealex/6814635 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<?php | |
$n = 0; | |
if(isset($_GET["n"])){ | |
$n = $_GET["n"]; | |
} | |
$r = 0; | |
$str = ""; | |
if($n != 0){ | |
for($i=1;$i<=$n;$i++){ | |
if($i != $n){ | |
$str = $str."$i^2+"; | |
} else{ | |
$str = $str."$i^2"; | |
} | |
$r = $r + pow($i, 2); | |
} | |
} | |
?> | |
<html> | |
<head> | |
<title>1summer</title> | |
</head> | |
<body> | |
<form action="a1q5.php" method="GET"> | |
<input type="text" name="n" id="n"> | |
<input type="submit" value="Submit"> | |
</form> | |
<br> | |
<b> | |
<?php | |
if($r != 0){ | |
echo "Result is: $r"; | |
} | |
?> | |
</b> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment