<u>Pascal:</u>
const a:array [1..5,1..5] of integer = ((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));
var I,j:integer;
begin
for i:=1 to 5 do
for j:=1 to 5 do write (a[I,j],' ');
writeln;
for i:=1 to 5 do
begin
for j:=1 to 5 do write (a[I,j]:3);
writeln;
end;
readln;
end.
<u>C++:</u>
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int a[5][5] = {{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},};
for (int I = 0; I<5; I++)
for (int j = 0; j<5; j++)
cout <<a[I][j] <<" ";
cout <<endl;
for (int I = 0; I<5; I++)
{
for (int j = 0; j<5; j++)
cout <<setw(3) <<a[I][j];
cout <<endl;
}
return 0;
}
<u>PascalABC.NET 3.3.5, сборка 1650 от 01.04.2018</u>
<u>Внимание! Если программа не работает, обновите версию!</u>
begin
var a:=ArrRandom(10,-50,50); a.Println;
Writeln('s5=',a[:5].Sum)
end.
<u>Пример</u>
-8 -42 14 -25 27 5 34 37 -24 24
s5=-34
1 МБ = 1*1024*1024*8 = 2¹⁰*2¹⁰*2³ бит = 8388608 бит ( или 2²³ бит)
4096 бит = 4096/8/1024 = 2¹²/2³/2¹⁰ = 0,5 КБ (или 2⁻¹ КБ)
2,5 ГБ = 2,5*2¹⁰*2¹⁰=2,5*1024*1024 = 2621440 КБ (или 2,5*2²⁰ КБ)
32 ГБ = 32*1024*1024*1024 = 2⁵*2*2¹⁰*2¹⁰*2¹⁰ = 34359738368 байт (или 2³⁵ байт)