Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function calculatecircle($r) {
- $counter = 0;
- for ($x = -$r; $x <= $r; $x++) {
- for ($y = -$r; $y <= $r; $y++){
- if (abs(sqrt($x*$x)+ sqrt($y*$y) - sqrt($r*$r)) < 1/2){
- echo "Step " . $counter . " " . "(" . $x . "," . $y . ")" . "\n";
- $counter++;
- }
- }
- }
- return true;
- }
- print_r(calculatecircle(5));
- ?>
Add Comment
Please, Sign In to add comment