O
O
ovsyanka50002019-03-27 15:14:09
Pascal
ovsyanka5000, 2019-03-27 15:14:09

Please help me to solve the problem?

The task is as follows: without storage, find two minimal numbers whose sum of squares is >500. snippet of my pascal program:

for i:=1 to n do begin 
 readln (f, a);
 if (a<min1) then begin min2:=min1; min1:=a; end;
 if (a>min1) and (a<min2) then min2:=a;
 end;

how can i check for squares? I can't figure it out myself. it is desirable to describe the algorithm in Pascal or simply explain the essence in words. thanks in advance.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
longclaps, 2019-03-27
@longclaps

begin
    writeln(16, 16);
end.

C
Cobalt747, 2019-04-07
@Cobalt747

start with 1 and increase with each step by 1.
As soon as you get the amount> 500 - interrupt the loop.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question