?>
Сделайте блок схему программы на c++ #include #include #include using namespace std; const int n = 3; int mas[n][n]; int sum2 = 0; int ar(int mas[n][n]) { int sum = 0; for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) sum += mas[i][j]; sum = sum / n * n; for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) sum2 =sum2 + (mas[i][j] - sum) * (mas[i][j] - sum); return sum2 ; } void main() { srand(time(0)); for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { mas[i][j] = 0 + rand() % 11; cout < < mas[i][j]; cout.width(6); } cout < < endl; } system("pause"); }
Ответы
n=5;
Var
ar:array[1..n] of integer;
ar2:array[1..n] of integer;
i,k:integer;
function prost(a:integer):boolean;
var i:integer;
b:boolean;
begin
b:=true;
for i:=2 to a div 2 do
if a mod i=0 then
begin;
b:=false;
break;
end;
if a=1 then b:=false;
prost:=b;
end;
begin;
randomize;
k:=0;
for i:=1 to n do
begin;
ar[i]:=random(101);
write(ar[i]:4);
end;
writeln;
for i:=1 to n do
if prost(ar[i]) then
begin;
inc(k);
ar2[k]:=ar[i];
write(ar2[k]:4);
end;
end.