Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Пузырьковая сортировка, среднее и среднее медианное
const n = 50; var a : array [0..n] of integer; i, j, temp : integer; mid, med : real; begin mid := 0; med := 0; randomize; for i := 0 to n do begin a[i] := random(51); a[n-2] := 100; a[n-1] := 200; a[n] := 300; if i < n div 3 then a[i] := 1; write(a[i]:3); mid := mid + a[i] end; mid := mid / n; writeln; for i := 0 to n-1 do for j := i+1 to n do if a[i] > a[j] then begin temp := a[i]; a[i] := a[j]; a[j] := temp; end; for i := 0 to n do write(a[i]:3); writeln; if (n mod 2) = 0 then med := a[n div 2] else med := (a[ n div 2 ] + a[ n div 2 + 1 ])/2; writeln ('mid= ', mid:5:2, ' med= ', med:5:2) end.
run
|
edit
|
history
|
help
0
array
Primo1
Trang
Задача №1516. Проверка на простоту (цикл while)
code
eje8
uuu
9
Zad 3 в
Calculatrice 1.0