The author posted a question in Programming
Help a dumb humanitarian with Pascal very simple? and got a better answer
Response from
What's in it for you?
Response from 0[+++++]
Not in the horse's mouth.
Not in the horse's mouth.
Response from 0[+++++]
Try for x from -r to +r and for y from -r to +r For each combination of x and y check the condition x² + y² <= r² If the condition holds, increase the counter. It is clear that step= 1.
Try for x from -r to +r and for y from -r to +r For each combination of x and y check the condition x² + y² <= r² If the condition holds, increase the counter. It is clear that step= 1.
Response from 0[+++++]
var i, j, k, r, sum: integer; begin r:=2; k:=0; for i:=1 to r do for j:=0 to r do if sqr i + sqr j <= sqr r then inc k ; writeln k*4+1 ; end.
var i, j, k, r, sum: integer; begin r:=2; k:=0; for i:=1 to r do for j:=0 to r do if sqr i + sqr j <= sqr r then inc k ; writeln k*4+1 ; end.