Created
November 15, 2011 20:23
-
-
Save sergeyromanov/1368214 to your computer and use it in GitHub Desktop.
Points in circle
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
program circle; | |
const | |
N = 3; | |
type | |
coords = array [1..N] of real; | |
var | |
x, y : coords; | |
x0, y0, r : real; | |
d : real; | |
i : integer; | |
begin | |
for i := 1 to N do begin | |
write('Enter x coordinate for point number ', i, ' >> '); | |
readln(x[i]); | |
end; | |
for i := 1 to N do begin | |
write('Enter y coordinate for point number ', i, ' >> '); | |
readln(y[i]); | |
end; | |
write('Enter x coordinate of circle centre >> '); | |
readln(x0); | |
write('Enter y coordinate of circle centre >> '); | |
readln(y0); | |
write('Enter the circle radius >> '); | |
readln(r); | |
writeln; | |
for i := 1 to N do begin | |
d := sqrt( sqr(x[i]-x0) + sqr(y[i]-y0) ); | |
if d <= r then | |
writeln('Point #',i,' (',x[i]:3:2,',',y[i]:3:2,') is in the circle'); | |
end; | |
readln; | |
end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment