1)uses crt; var i,j,n,ans:integer; begin read(n); for i:=1 to 9 do for j:=0 to 9 do if i+j=n then ans:=ans+1; writeln(ans); end. 2) uses crt; var i,n:integer; x:array[1..100] of integer; begin writeln('Введите количество x и значения: '); read(n); for i:=1 to n do read(x[i]); writeln('x y'); for i:=1 to n do writeln(x[i],' ',x[i]*x[i]+3); end. 3. uses crt; var i:integer; begin for i:=1 to 5 do write(i*i*i,' '); end. 4. uses crt; var i,n,sum:real; begin writeln('Введите N:'); read(n); i:=3; while i<=n do begin sum:=sum+1/i; i:=i+3; end; writeln(sum); end. 5. uses crt; var j,i,n,sum:integer; a:array[1..100] of integer; begin writeln('Введите количество чисел и сами числа:'); read(n); for i:=1 to n do begin sum:=0; read(a[i]); for j:=1 to length(inttostr(a[i])) do sum:=sum+strtoint(inttostr(a[i])[j]); if sum mod 3 = 0 then write(a[i],' '); end; end. 6.a)uses crt; var n:string; begin read(n); writeln(max(strtoint(n[1]),strtoint(n[2]))); end. б) uses crt; var n:string; begin read(n); writeln(max(max(strtoint(n[1]),strtoint(n[2])),strtoint(n[3]))); end.
Var m : array[0..6] of Integer; i,k,N : Integer; Begin For i:=0 to 6 do m[i]:=0; Readln(N); k:=6; While N>0 do Begin If N>=Power(2,k) then Begin N:=N-Trunc(Power(2,k)); Inc(m[k]); end else Dec(k); end; For i:=0 to 6 do Writeln(Power(2,i),' ',m[i],' шт.'); end.
Еще вариант: Const NN = 7; money : array[1..7] of Integer = (1,2,4,8,16,32,64); Var m : array[1..NN] of Integer; i,k,N : Integer; Begin For i:=1 to NN do m[i]:=0; Readln(N); k:=NN; While N>0 do Begin If N>=money[k] then Begin N:=N-money[k]; Inc(m[k]); end else Dec(k); end; For i:=1 to NN do Writeln(money[i],' ',m[i],' шт.'); end.
var i,j,n,ans:integer;
begin
read(n);
for i:=1 to 9 do
for j:=0 to 9 do
if i+j=n then
ans:=ans+1;
writeln(ans);
end.
2)
uses crt;
var i,n:integer;
x:array[1..100] of integer;
begin
writeln('Введите количество x и значения: ');
read(n);
for i:=1 to n do
read(x[i]);
writeln('x y');
for i:=1 to n do
writeln(x[i],' ',x[i]*x[i]+3);
end.
3.
uses crt;
var i:integer;
begin
for i:=1 to 5 do
write(i*i*i,' ');
end.
4.
uses crt;
var i,n,sum:real;
begin
writeln('Введите N:');
read(n);
i:=3;
while i<=n do
begin
sum:=sum+1/i;
i:=i+3;
end;
writeln(sum);
end.
5.
uses crt;
var j,i,n,sum:integer;
a:array[1..100] of integer;
begin
writeln('Введите количество чисел и сами числа:');
read(n);
for i:=1 to n do
begin
sum:=0;
read(a[i]);
for j:=1 to length(inttostr(a[i])) do
sum:=sum+strtoint(inttostr(a[i])[j]);
if sum mod 3 = 0 then
write(a[i],' ');
end;
end.
6.a)uses crt;
var n:string;
begin
read(n);
writeln(max(strtoint(n[1]),strtoint(n[2])));
end.
б)
uses crt;
var n:string;
begin
read(n);
writeln(max(max(strtoint(n[1]),strtoint(n[2])),strtoint(n[3])));
end.
i,k,N : Integer;
Begin
For i:=0 to 6 do m[i]:=0;
Readln(N);
k:=6;
While N>0 do
Begin
If N>=Power(2,k) then
Begin
N:=N-Trunc(Power(2,k));
Inc(m[k]);
end else Dec(k);
end;
For i:=0 to 6 do Writeln(Power(2,i),' ',m[i],' шт.');
end.
Еще вариант:
Const
NN = 7;
money : array[1..7] of Integer = (1,2,4,8,16,32,64);
Var m : array[1..NN] of Integer;
i,k,N : Integer;
Begin
For i:=1 to NN do m[i]:=0;
Readln(N);
k:=NN;
While N>0 do
Begin
If N>=money[k] then
Begin
N:=N-money[k];
Inc(m[k]);
end else Dec(k);
end;
For i:=1 to NN do Writeln(money[i],' ',m[i],' шт.');
end.