Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
21
Добавлен:
20.02.2017
Размер:
17.94 Кб
Скачать

program b1;

uses crt;

var i,k,j,y:integer;

a:array[1..10] of integer;

begin

clrscr;

k:=0; j:=0; y:=0;

for i:=1 to 10 do read(a[i]);

for i:=1 to 10 do

if a[i]<0 then k:=k+1

else if a[i]>0 then j:=j+1

else y:=y+1;

writeln('0-den kichileri=',k);

writeln('0-den ulkender=',j);

writeln('0-ge tehder=',y);

readkey;

end.

program b2;

uses crt;

var i,n:integer;

begin

clrscr;

writeln('sandi engiziniz’);

read(n);

for i:=1 to n do

if i mod 2=1 then write(i,’ ‘);

readln;

end.

program b3;

uses crt;

var j,s:integer;

begin

clrscr;

s:=0;

for j:=100 to 200 do

if j mod 17=0 then

s:=s+j;

writeln(‘S=’,s);

readln;

end.

program b4;

uses crt;

var i:integer;

s:array[1..20] of real;

begin

clrscr;

for i:=1 to 20 do

s[i]:=s[i]*2.54;

writeln('i=',i:4, 'maniboladi= ',s[i]:3:2);

readln;

end.

Program b5;

Uses crt;

Label 1, 9;

Const n=4;

Var max, I, j, k, l:integer;

a:array [1..n, 1..n] of integer;

s1, s2:array [1..n-1] of integer;

w:char;

BEGIN

Clrscr;

1:writeln (‘Zaidite’, n, ‘x’,n’ 4isel matricy po strokam’);

{Vvod elementov matricy}

For i:=1 to n do

Begin

For j:=1 to n do Write (a[I, j]:2);

WRIteln;

For k:=1 to n-1 do begin s1[k]:0; s2[k]:=0; end;

{pods4et sum elementov parallel’nyh diagonalei matricy}

For k:=1 to n-1 do

For i :k+1 to n do

Begin

S1[k]:=s1[k]+a[I, i-k];

S2[k]:=s2[k]+a[i-k, i]; end;

{Vyvod naidennyh summ}

For k:=1 to n-1 do write (s1[k]:3);

Writeln;

For k:=1 to n-1 do write (s2[k]:3);

{opredelenie maksimuma naidennyh summ}

Max:=0;

For k:=1 to n-1 do

Begin

If max<s1[k] then max:=s1[k;

If max<s2[k] then max:=s2[k];

End;

Writeln;

Writeln;

Writeln (‘max=’, max);

Writeln;

Writeln (‘dlya vyhoda naberite 4islo 9’);

Writeln(‘dlya prodoljenya – lyuboi klavishi’);

W:=readkey;

If W<>’9’ then goto 1;

END.

program b7;

uses crt;

var i,k,s,m:integer;

a:array [1..10] of integer;

begin

clrscr;

for i:=1 to 10 do

read(a[i]);

m:=a[1];

for i:=2 to 10 do

if m>a[i] then

begin

m:=a[i];

k:=i;

end;

s:=0;

for k:=k+1 to 10 do

s:=s+a[k];

write('jiauabi=',s:6);

readkey;

end.

Program b8;

uses crt;

var i,k,s,m:integer;

a:array [1..10] of integer;

begin

clrscr;

for i:=1 to 10 do

read(a[i]);

m:=a[1];

for i:=2 to 10 do

if m<a[i] then

begin

m:=a[i];

k:=i;

end;

s:=0;

for k:=k+1 to 10 do

s:=s+a[k];

write('jiauabi=',s:6);

readkey;

end.

program b10;

uses crt;

var i,j,k,m,n,s:integer;

a,b:array[1..9] of integer;

begin

clrscr;

writeln('a[i]=');

for i:=1 to 9 do

read(a[i]);

writeln('n,m');

read(n,m);

k:=0;

j:=0;

for i:=1 to 9 do

if (a[i]>n) and (a[i]<m) then

begin

j:=j+1;

b[j]:=a[i];

end;

for i:=1 to 9 do

if (a[i]<n) or (a[i]>m) then

begin

k:=k+1;

b[j+k]:=a[i];

end;

for s:=1 to 9 do

write(' ',b[s]:5);

readkey;

end.

program b11;

uses crt;

const n=6;

m=5;

var i,k,s:integer;

a:array[1..n] of integer;

b:array[1..m] of integer;

c:array[1..m+n] of integer;

begin

clrscr;

for i:=1 to n do

read(a[i]);

for i:=1 to m do

read(b[i]);

for k:=1 to n do

c[k]:=a[k];

for k:=n+1 to m+n do

c[k]:=b[k-n];

for k:=1 to m+n do

write(c[k],' ');

s:=c[1];

for k:=2 to m+n do

if s<c[k] then

s:=c[k];

writeln('jiauabi=',s:5);

readkey;

end.

program b12;

uses crt;

var i,j,k,l,g:integer;

begin

clrscr;

g:=0;

for i:=3 to 7 do

for j:=3 to 7 do

for k:=3 to 7 do

for l:=3 to 7 do

if (j<>i) and (i<>k) and (i<>l) and (j<>k) and (j<>l) and (k<>l) then

begin

write(' ',i,j,k);

g:=g+1;

end;

writeln;

writeln('bolatin cani=',g:4);

readkey;

end.

program b13;

uses crt;

Label 1;

var i,j,n,P,m,k:integer;

W:char;

BEGIN

clrscr;

1:Write(‘ Candar boladi --->');

for i:=1 to 9 do for j:=0 to 9 do for k:=0 to 9 do

if (i+j+k=15) then Write(i,j,k,' ');

Writeln;

Writeln(' Ecli vxod vibrai 9');

W:=readkey;

if W<>'9' then goto 1;

END.

program b14;

uses crt;

var i,j,m:integer;

begin

clrscr;

read(m);

for i:=1 to m do

for j:=1 to m do

if i*i+j*j=m then

writeln(i,' ',j,' ');

readkey;

end.

Соседние файлы в папке 5.Алгоритм и языки программ