function summdel(x:integer):integer; //результат - сумма делителей х var k,sum:integer; begin sum:=0; for k := 1 to x div 2 + 1 do if x mod k = 0 then sum:= sum+k; summdel:=sum; end;
begin writeln('Введите границы a,b '); readln(a,b); maxsumm := 1; max := 1; for i := a to b do begin if summdel(i) > maxsumm then begin maxsumm:= summdel(i); max := i; end; end; writeLn('Максимальная сумма делителей - ', maxsumm, ' число - ',max) 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.
var a,b, I, maxsumm, max : integer;
function summdel(x:integer):integer; //результат - сумма делителей х
var k,sum:integer;
begin
sum:=0;
for k := 1 to x div 2 + 1 do
if x mod k = 0 then sum:= sum+k;
summdel:=sum;
end;
begin
writeln('Введите границы a,b ');
readln(a,b);
maxsumm := 1;
max := 1;
for i := a to b do
begin
if summdel(i) > maxsumm then
begin maxsumm:= summdel(i);
max := i;
end;
end;
writeLn('Максимальная сумма делителей - ', maxsumm, ' число - ',max)
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.