Advertisement
CyberPascal

Untitled

Dec 2nd, 2014
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.96 KB | None | 0 0
  1. Program Nastya; uses crt;
  2.  
  3. const n=15;
  4.  
  5. var b:array [1..n] of integer;
  6.     i:byte;
  7.  
  8. Begin clrscr;
  9. Write('--------------------------------------------------------------------------------');
  10. Writeln('Исходный массив B:');
  11. for i:=1 to n do
  12.     Begin
  13.     B[i]:=Random(11);
  14.     B[i]:=B[i]-5;
  15.     Write(B[i]:4);
  16.     end;
  17. Writeln;
  18. Write('--------------------------------------------------------------------------------');
  19. Writeln('Преобразованный массив B:');
  20. for i:=1 to n do
  21.     Begin
  22.     if (B[i] > 0) then B[i]:=-B[i]
  23.                   else if (B[i] < 0) then B[i]:=Abs(B[i]);
  24.     Write(B[i]:4);
  25.     end;
  26. Writeln;
  27. Write('--------------------------------------------------------------------------------');
  28. GotoXY(15,WhereY); Writeln('Для выхода из программы нажмите клавишу "Enter"');
  29. Write('--------------------------------------------------------------------------------');
  30. Readln;
  31. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement