Var A,S,n:integer; Begin WriteLn('Введите целое число'); ReadLn(A); S:=0; n:=0; While A<>0 do Begin S:=S+A mod 10; n:=n+1; A:= A div 10 End; WriteLn('Sr = ',S/n); End.
Var A,S:integer; Begin WriteLn('Введите целое число'); ReadLn(A); S:=0; While A<>0 do Begin if (A mod 10) mod 3 = 0 then S:=S+A mod 10; A:=A div 10 End; WriteLn('S = ',S); End.
Var A,m:integer; Begin WriteLn('Введите целое число'); ReadLn(A); m:=9; While A<>0 do Begin if A mod 10 < m then m:= A mod 10; A:=A div 10 End; WriteLn('Min = ',m); End.
Lyudmila-Popova
13.05.2020
//FPC 2.6.4 const m = 3; n = 3; var a : array[1..n, 1..m] of integer; max1: array[1..n] of integer; min1: array[1..n] of integer; max2: array[1..m] of integer; min2: array[1..m] of integer; i, j, min, max, count: integer; begin for i:=1 to n do for j:=1 to m do begin write ('Введите элемент матрицы [', i, ', ', j, ']: '); readln (a[i, j]); end;
for i:=1 to n do begin min:=a[i, 1]; max:=a[i, 1]; for j:=2 to m do begin if a[i, j]<min then min:=a[i, j]; if a[i, j]>max then max:=a[i, j]; end; min1[i]:=min; max1[i]:=max; end;
for j:=1 to m do begin min:=a[1, j]; max:=a[1, j]; for i:=2 to n do begin if a[i, j]<min then min:=a[i, j]; if a[i, j]>max then max:=a[i, j]; end; min2[j]:=min; max2[j]:=max; end;
writeln; writeln ('Введенная матрица: '); for i:=1 to n do begin for j:=1 to m do write (a[i, j]:6); writeln; end; writeln; count:=0; for i:=1 to n do for j:=1 to m do if ((a[i, j]=max1[i]) and (a[i, j]=min2[j])) or ((a[i, j]=max2[j]) and (a[i, j]=min1[i])) then begin writeln ('Седловая точка: [', i, ', ', j, ']'); inc (count); end; writeln ('Всего седловых точек: ', count); end.
вроде должна быть