Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program InputArray;
- {$APPTYPE CONSOLE}
- uses
- Windows, SysUtils;
- type
- TArray = array of array of Integer;
- var
- n, i, j, sum, k: Integer;
- myArray: TArray;
- begin
- SetConsoleCP(1251);
- SetConsoleOutputCP(1251);
- // Ввод размера массива
- Write('Введите размер массива: ');
- ReadLn(n);
- // Инициализация динамического массива
- SetLength(myArray, n, n);
- // Ввод значений массива
- for i := 0 to n - 1 do
- begin
- for j := 0 to n - 1 do
- begin
- Write('Введите значение для элемента [', i + 1, ',', j + 1, ']: ');
- ReadLn(myArray[i, j]);
- end;
- end;
- // Вывод массива
- Writeln('Введенный массив:');
- for i := 0 to n - 1 do
- begin
- for j := 0 to n - 1 do
- Write(myArray[i, j]:5);
- Writeln;
- end;
- sum := 0;
- k := 0;
- for i := 0 to high(myarray) div 2 do
- begin
- for j := high(myarray) div 2 downto 0 do
- begin
- sum := sum + myArray[i, j];
- Writeln(i, j);
- end;
- end;
- for i := 0 to high(myarray) div 2 do
- begin
- for j := (high(myarray) div 2) + 1 to high(myarray) do
- begin
- sum := sum + myArray[i, j];
- Writeln(i, j);
- end;
- end;
- for j := 0 to high(myarray) div 2 do
- begin
- for i := (high(myarray) div 2) + 1 to high(myarray) do
- begin
- sum := sum + myArray[i, j];
- Writeln(i, j);
- end;
- end;
- for j := (high(myarray) div 2) + 1 to high(myarray) do
- begin
- for i := high(myarray) downto (high(myarray) div 2) + 1 do
- begin
- sum := sum + myArray[i, j];
- Writeln(i, j);
- end;
- end;
- Writeln('popa ', sum);
- ReadLn;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement