SHARE
TWEET

Untitled

a guest Nov 19th, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. program task3;
  2. const n =50;
  3. var
  4. A:array[1..n] of integer;
  5. i,num,flag:integer;
  6. begin
  7.   readln(num);//заданое число
  8.   flag:=0;
  9. for i:=1 to n do
  10.   begin
  11.   A[i]:=Random(20); //заполняем случайными числами
  12.   //writeln('t ',A[i]); //вывод чисто для теста
  13.   end;
  14. for i:=2 to n do
  15.   begin
  16.     if A[i]+A[i-1] = num then //если соседние элементы равны заданному числу
  17.     begin
  18.     writeln(A[i-1],' ',A[i]);
  19.     flag:=1;
  20.     end;
  21.   end;
  22. if(flag = 0) then
  23.   writeln('Таких пар чисел нет!');
  24. end.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top