13) program pasc;
var a:array[1..200] of real; i,n:integer; d,r1,R2:real; begin readln(n); for i:=1 to n do begin readln(a[2*i-1]); readln(a[2*i]); end; d:=sqrt(sqr(a[1])+sqr(a[2])) r1:=d; R2:=d; for i:=1 to n do begin d:=sqrt(sqr(a[2*i-1])+sqr(a[2*i])); if dR2 then R2:=d end; writeln('r=',r1); writeln('R=',R2) end.
14) program pasc;
var a:array[1..100,1..100] of integer;
i,j,n:integer; begin readln(n); for i:=1 to n div 2 do for j:=i to n do
begin a[i,j]:=0; if ((j>=i) and (j<=(n-i+1))) and (i<=(n div 2)+1)
then begin a[i,j]:=1; a[n-i+1,j]:=1; end;
end; if n mod 2=1 then a[n div 2+1,j div 2+1]:=1; for i:=1 to n do
begin for j:=1 to n do write(a[i,j]:2); writeln end; readln end.
15) program mas;
var a:array[1..100] of integer;
i,n,k:integer;
begin readln(n); for i:=1 to n do begin readln(a[i]); end; i:=1; while i16) program Min;
type Mass=array [1..100] of integer;
function MinK(X:Mass;k:integer):integer;
var Result,R:integer;
begin
Result:=X[k]; if k>1 then
begin
R:=MinK(X,k-1); if Result>R then Result:=R end;
MinK:=Result end; ar X:Mass; n,i:integer; begin readln(n);
for i:=1 to n do begin readln(X[i]) end; writeln('Min(X)=',MinK(X,n))
end.
17) program gauss;
uses crt;
const nn=10;
var a:array [1..nn,1..nn] of double;
x,b:array [1..nn] of double;
n,i,j,k:integer;d:double; begin clrscr; readln(n); for i:=1 to n do
begin for j:=1 to n do read(a[i,j]); end; for i:=1 to n do read (b[i]);
for i:=1 to n-1 do begin for k:=i+1 to n do begin
d:=a[k,i]/a[i,i]; for j:=i+1 to n do a[k,j]:=a[k,j]-a[i,j]*d;
b[k]:=b[k]-b[i]*d; end; end; for i:=n downto 1 do
begin for j:=i+1 to n do b[i]:=b[i]-a[i,j]*x[j]; x[i]:=b[i]/a[i,i]; end; writeln; for i:=1 to n do writeln('X[',i:2,']=',x[i]:1:5); end.
Dostları ilə paylaş: |