Var a,d,count,i:integer; function CountDay(a:integer):integer; begin if (a>=1) then countday:=31; if (a>=2) then countday:=28; if (a>=3) then countday:=31; if (a>=4) then countday:=30; if (a>=5) then countday:=31; if (a>=6) then countday:=30; if (a>=7) then countday:=31; if (a>=8) then countday:=31; if (a>=9) then countday:=30; if (a>=10) then countday:=31; if (a>=11) then countday:=30; if (a>=12) then countday:=31; end; begin count:=0; write('Введите День: '); readln(d); write('Введите Месяц: '); readln(a); if (a<=0)or(a>12)or(d<=0)or(d>countday(a)) then writeln('Ошшибка в данных! ') else begin for i:=a to 12 do count:=count+countday(i); count:=count-d; writeln('До нового года осталось ',count,' дней'); end; end.
1.const N=10; type Vector = array [1..N] of integer; var B: vector; max :integer; procedure IntVector(N: integer; var a: vector); begin for var i := 1 to N do a[i] := random(100); end; procedure OutVector(N: integer; a: vector); begin for var i := 1 to N do begin write(a[i]:5); end; end; procedure Srav (a:vector; N,g:integer); begin g := a[1]; for var i:=1 to N do if (g < a[i]) then g:=a[i]; writeln (g); end; Begin IntVector(N, B); writeln; OutVector(N, B ); writeln; Srav(B,N, max); writeln; End. 2. const N = 10; type Vector = array [1..N] of integer; var B: vector; r,v : real; procedure IntVector(N: integer; var a: vector); begin for var i := 1 to N do a[i] := random(20); end; procedure OutVector(N: integer; a: vector); begin for var i := 1 to N do begin write(a[i]:5); end; end; function srednee(a: vector; N: integer): real; begin for var i := 1 to N do begin result := (result + a[i]); end; end; function kolvo(a: vector; g: real): real; begin for var i := 1 to N do if (a[i] < (srednee(a, N)/10)) then result := result + 1; end; begin IntVector(N, B); writeln; OutVector(N, B ); writeln; writeln ((srednee(B, N)/10):5:3); r := kolvo(B, v); writeln(r); end.
function CountDay(a:integer):integer;
begin
if (a>=1) then countday:=31;
if (a>=2) then countday:=28;
if (a>=3) then countday:=31;
if (a>=4) then countday:=30;
if (a>=5) then countday:=31;
if (a>=6) then countday:=30;
if (a>=7) then countday:=31;
if (a>=8) then countday:=31;
if (a>=9) then countday:=30;
if (a>=10) then countday:=31;
if (a>=11) then countday:=30;
if (a>=12) then countday:=31;
end;
begin
count:=0;
write('Введите День: ');
readln(d);
write('Введите Месяц: ');
readln(a);
if (a<=0)or(a>12)or(d<=0)or(d>countday(a)) then
writeln('Ошшибка в данных! ')
else
begin
for i:=a to 12 do
count:=count+countday(i);
count:=count-d;
writeln('До нового года осталось ',count,' дней');
end;
end.
type Vector = array [1..N] of integer;
var B: vector;
max :integer;
procedure IntVector(N: integer; var a: vector);
begin
for var i := 1 to N do a[i] := random(100);
end;
procedure OutVector(N: integer; a: vector);
begin for var i := 1 to N do
begin write(a[i]:5);
end;
end;
procedure Srav (a:vector; N,g:integer);
begin
g := a[1];
for var i:=1 to N do
if (g < a[i]) then g:=a[i];
writeln (g);
end;
Begin
IntVector(N, B);
writeln;
OutVector(N, B );
writeln;
Srav(B,N, max);
writeln;
End.
2. const N = 10;
type Vector = array [1..N] of integer;
var B: vector;
r,v : real;
procedure IntVector(N: integer; var a: vector);
begin
for var i := 1 to N do
a[i] := random(20);
end;
procedure OutVector(N: integer; a: vector);
begin
for var i := 1 to N do
begin
write(a[i]:5);
end;
end;
function srednee(a: vector; N: integer): real;
begin
for var i := 1 to N do begin result := (result + a[i]);
end;
end;
function kolvo(a: vector; g: real): real;
begin
for var i := 1 to N do
if (a[i] < (srednee(a, N)/10)) then result := result + 1;
end;
begin
IntVector(N, B); writeln;
OutVector(N, B );
writeln;
writeln ((srednee(B, N)/10):5:3); r := kolvo(B, v);
writeln(r);
end.