uses crt; const n=10; type Mas=array [1..n] of integer; Var A: Mas; i, x:integer; priznak: boolean;
Begin ClrScr; priznak:=false; WriteLn(' Massiv: '); for i:=1 to n do begin A[i]:=-100+random(200); Write(A[i]:5); end; WriteLn; Write(' X = '); ReadLn(X); WriteLn; for i:=1 to n do if X=A[i] then begin WriteLn (' X = ', A[i], ' Index = ', i); priznak:=true; end; if priznak=false then Writeln (' None...');
ReadLn; end.
2. А вот реверс:
uses crt; const n=10; type Mas=array [1..n] of integer; Var A: Mas; i:integer;
Begin ClrScr; WriteLn(' Massiv: '); for i:=1 to n do begin A[i]:=-100+random(201); Write(A[i]:5); end; WriteLn; WriteLn(' Revers: '); for i:=n downto 1 do Write(A[i]:5); WriteLn; ReadLn; end.
И. наконец, последняя программа:
uses crt; const n=5; var i, x : integer; P:longint;
begin ClrScr; P:=1; WriteLn(' Wwod Massiva: '); for i:=1 to n do begin ReadLn (x); P:=P*x; end; WriteLn; WriteLn(' P = ', P); WriteLn; ReadLn; end.
1. Program A1; var s,m:integer; begin Writeln('Vvedi vozrast SASHI :'); Read(s); Writeln('Vvedi vozrast MASHI :'); Read(m); If s>m then writeln('SASHA starshe MASHI') else writeln('MASHA starshe SASHI'); end.
2. Program A1; var s,m:integer; begin Writeln('Vvedi vozrast SASHI :'); Read(s); Writeln('Vvedi vozrast MASHI :'); Read(m); If s=m then writeln('SASHA i MASHA rovestniki') else If s>m then writeln('SASHA starshe MASHI') else writeln('MASHA starshe SASHI'); end.
3. Program A1; var a,b,c,d:real; begin Readln(a); Readln(b); Readln(c); If ((b<a) and (b<c)) then begin d:=a; a:=b; b:=d; end; If ((c<a) and (c<b)) then begin d:=a; a:=c; c:=d; end; If ((a>b) and (a<c)) then begin d:=b; b:=a; a:=d; end; If ((c<b) and (c>a)) then begin d:=b; b:=c; c:=d; end; If ((a>c) and (a>b)) then begin d:=c; c:=a; a:=d; end; If ((b>c) and (b>a)) then begin d:=c; c:=b; b:=d; end; writeln(a,'<',b,'<',c); end.
uses crt;
const n=10;
type Mas=array [1..n] of integer;
Var A: Mas;
i, x:integer;
priznak: boolean;
Begin
ClrScr;
priznak:=false;
WriteLn(' Massiv: ');
for i:=1 to n do
begin
A[i]:=-100+random(200);
Write(A[i]:5);
end;
WriteLn;
Write(' X = '); ReadLn(X);
WriteLn;
for i:=1 to n do
if X=A[i] then
begin
WriteLn (' X = ', A[i], ' Index = ', i);
priznak:=true;
end;
if priznak=false then Writeln (' None...');
ReadLn;
end.
2. А вот реверс:
uses crt;
const n=10;
type Mas=array [1..n] of integer;
Var A: Mas;
i:integer;
Begin
ClrScr;
WriteLn(' Massiv: ');
for i:=1 to n do
begin
A[i]:=-100+random(201);
Write(A[i]:5);
end;
WriteLn;
WriteLn(' Revers: ');
for i:=n downto 1 do
Write(A[i]:5);
WriteLn;
ReadLn;
end.
И. наконец, последняя программа:
uses crt;
const n=5;
var i, x : integer;
P:longint;
begin
ClrScr;
P:=1;
WriteLn(' Wwod Massiva: ');
for i:=1 to n do
begin
ReadLn (x);
P:=P*x;
end;
WriteLn;
WriteLn(' P = ', P);
WriteLn;
ReadLn;
end.
var
s,m:integer;
begin
Writeln('Vvedi vozrast SASHI :');
Read(s);
Writeln('Vvedi vozrast MASHI :');
Read(m);
If s>m then writeln('SASHA starshe MASHI') else writeln('MASHA starshe SASHI');
end.
2.
Program A1;
var
s,m:integer;
begin
Writeln('Vvedi vozrast SASHI :');
Read(s);
Writeln('Vvedi vozrast MASHI :');
Read(m);
If s=m then writeln('SASHA i MASHA rovestniki') else
If s>m then writeln('SASHA starshe MASHI') else writeln('MASHA starshe SASHI');
end.
3.
Program A1;
var
a,b,c,d:real;
begin
Readln(a);
Readln(b);
Readln(c);
If ((b<a) and (b<c)) then begin d:=a; a:=b; b:=d; end;
If ((c<a) and (c<b)) then begin d:=a; a:=c; c:=d; end;
If ((a>b) and (a<c)) then begin d:=b; b:=a; a:=d; end;
If ((c<b) and (c>a)) then begin d:=b; b:=c; c:=d; end;
If ((a>c) and (a>b)) then begin d:=c; c:=a; a:=d; end;
If ((b>c) and (b>a)) then begin d:=c; c:=b; b:=d; end;
writeln(a,'<',b,'<',c);
end.