Напишите на гипотетическом языке запросов команду, формирующую таблицу расшифровки кодов специальностей. Строки должны быть упорядочены по воарастанию кодов.
Program n1; var a,b,sum,pr:integer; begin sum:=0; pr:=1; for a:=1 to 10 do begin sum:=sum+a; end; writeln('сумма чисел от 1 до 10 = ',sum); for a:=1 to 10 do begin pr:=pr*a; end; writeln('произведение чисел от 1 до 10 = ',pr); end.
program n2; var a,b,n:integer; begin writeln('введите степень n'); readln(n); b:=1; for a:=1 to n do begin b:=b*2; end; writeln('2 в ',n,' степени = ', b); end.
program n3; var sum,a,n,n2:integer; begin writeln('введите число n'); readln(n); n2:=n; while n<>0 do begin a:=n mod 10; sum:=a+sum; n:=n div 10; end; writeln('сумма цифр ',n2,' = ',sum); end.
function linelength(x1, y1, x2, y2: integer): real; begin linelength := sqrt(sqr(x2 - x1) + sqr(y2 - y1)); end;
procedure ger(a, b, c: real); var p: real; begin p := (a + b + c) / 2; sc := sqrt(p * (p - a) * (p - b) * (p - c)); end;
begin write('1:');readln(x1, y1); write('2:');readln(x2, y2); write('3:');readln(x3, y3); write('4:');readln(x4, y4); ger(linelength(x1, y1, x2, y2), linelength(x2, y2, x3, y3), linelength(x1, y1, x3, y3)); s := s + sc; ger(linelength(x1, y1, x4, y4), linelength(x4, y4, x3, y3), linelength(x1, y1, x3, y3)); s := s + sc; writeln(s); end. //3) var a, b, c: integer;
function sce(var a: integer): integer; var sc, c: integer; begin while a <> 0 do begin c := a mod 10; a := a div 10; sc := sc + c; end; sce := sc; end;
begin read(a, b, c); if (sce(a) > sce(b)) and (sce(a) > sce(c)) then writeln(a) else if (sce(b) > sce(a)) and (sce(b) > sce(c)) then writeln(b) else if (sce(c) > sce(a)) and (sce(c) > sce(b)) then writeln(c) else if (sce(c) = sce(a)) and (sce(a) = sce(b)) then writeln('Равны'); end.
var a,b,sum,pr:integer;
begin
sum:=0;
pr:=1;
for a:=1 to 10 do begin
sum:=sum+a;
end;
writeln('сумма чисел от 1 до 10 = ',sum);
for a:=1 to 10 do begin
pr:=pr*a;
end;
writeln('произведение чисел от 1 до 10 = ',pr);
end.
program n2;
var a,b,n:integer;
begin
writeln('введите степень n');
readln(n);
b:=1;
for a:=1 to n do begin
b:=b*2;
end;
writeln('2 в ',n,' степени = ', b);
end.
program n3;
var sum,a,n,n2:integer;
begin
writeln('введите число n');
readln(n);
n2:=n;
while n<>0 do begin
a:=n mod 10;
sum:=a+sum;
n:=n div 10;
end;
writeln('сумма цифр ',n2,' = ',sum);
end.
var
x1, y1, x2, y2, x3, y3, x4, y4: integer;
s, sc: real;
function linelength(x1, y1, x2, y2: integer): real;
begin
linelength := sqrt(sqr(x2 - x1) + sqr(y2 - y1));
end;
procedure ger(a, b, c: real);
var
p: real;
begin
p := (a + b + c) / 2;
sc := sqrt(p * (p - a) * (p - b) * (p - c));
end;
begin
write('1:');readln(x1, y1);
write('2:');readln(x2, y2);
write('3:');readln(x3, y3);
write('4:');readln(x4, y4);
ger(linelength(x1, y1, x2, y2), linelength(x2, y2, x3, y3), linelength(x1, y1, x3, y3));
s := s + sc;
ger(linelength(x1, y1, x4, y4), linelength(x4, y4, x3, y3), linelength(x1, y1, x3, y3));
s := s + sc;
writeln(s);
end.
//3)
var
a, b, c: integer;
function sce(var a: integer): integer;
var
sc, c: integer;
begin
while a <> 0 do
begin
c := a mod 10;
a := a div 10;
sc := sc + c;
end;
sce := sc;
end;
begin
read(a, b, c);
if (sce(a) > sce(b)) and (sce(a) > sce(c)) then writeln(a) else
if (sce(b) > sce(a)) and (sce(b) > sce(c)) then writeln(b) else
if (sce(c) > sce(a)) and (sce(c) > sce(b)) then writeln(c) else
if (sce(c) = sce(a)) and (sce(a) = sce(b)) then writeln('Равны');
end.