-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathE.cob
31 lines (31 loc) · 847 Bytes
/
E.cob
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Program-ID.E.
Data Division.
Working-Storage Section.
01 s Pic X(12).
01 t Pic 9(9).
01 a Pic 9(9).
01 i Pic 9(9).
01 j Pic 9(9).
01 n Pic 9(9).
01 .
03 x Pic S9(9) Occurs 64 times.
03 y Pic S9(9) Occurs 64 times.
Procedure Division.
Accept s.
Move s to n;
Perform varying i from 1 by 1 until i>n
Accept s
Move s to x(i)
Accept s
Move s to y(i)
End-perform
Perform varying i from 2 by 1 until i>n
Perform varying j from 1 by 1 until j=i
compute t=(x(i)-x(j))*(x(i)-x(j))+(y(i)-y(j))*(y(i)-y(j))
if t>a
Move t to a
End-if
End-perform
End-perform.
Display function sqrt(a).
Stop run.