O`zbеkiston rеspublikasi oliy va o`rta maxsus ta'lim



Yüklə 1,77 Mb.
səhifə74/92
tarix25.06.2023
ölçüsü1,77 Mb.
#135048
1   ...   70   71   72   73   74   75   76   77   ...   92
Algaritm qo`llanma

3) Program Sortirovka;
Const NMax = 100;
Type MasNat = Array [1 .. NMax] Of 1.. High (Integer);Var A : MasNat; I, J, N, M, K, Vsp : Integer; Log : Boolean; F : Text; Procedure WriteMassiv; Var I : Integer; Begin For I := 1 To N Do Write( A [I] : 5); WriteLn; End; Begin Assign(F, 'D : \ workdir \ shest \ ttt.txt' ); ReWrite(F); ReadLn(N); Randomize; For I := 1 To N Do A[I] := 1 + Random(1000); WriteMassiv; For I := 1 To N Do Write( F, A[I] : 5); WriteLn(F); ReadLn(K); M := 0; I := 1; While I <= N - 1 Do Begin Log := True; J := I; While (J <= N) And Log Do Begin Log : = A[J] Mod K < > M; J := J + 1; End; If Not Log Then Begin Vsp := A[J - 1]; A[ J - 1] := A[I]; A [ I ] := Vsp; I := I + 1; End Else M := M + 1; End; Write Massiv; For I := 1 To N Do Write( F, A[I] : 5); WriteLn (F); Flush (F); Close (F) End.
4) program pasc;
var a,d : real; i, k, n : integer; b : array [1..100] of real; begin readln (a);
readln (d); readln (n); for i:=1 to n do begin readln ( b [i] );
end; k : =0; for I : =1 to n do if ( b[i] > (a+d)) or (b[i]< (a-d)) then k:=k+1; if k : =0 then writeln(a) else writeln(k) end.
5) program pasc;
var a, b : array [1..100] of integer; n, i, j, k : integer;
begin readln (n);
for I :=1 to n do begin readln ( a [ I ] ); end; readln (k); j :=1; for I : =1 to n do if ( a[i] mod 10 = k) then begin b[j] : = a[i]; write ( b[j] );
j : =j+1; end; end.


6) program pasc;
var n, i, j : integer; a : array [1..100, 1..100] of integer;
begin readln (n);
for i:=1 to n do for j:=1 to n do begin a [i, j] : = j-i+1;
if a[i, j] <=0 then a [i, j]:=abs (a[ i, j]-2); end; for i:=1 to n do
begin for j:=1 to n do write (a [i, j]:3); writeln end end.


7) program pasc;
var n, i, j : integer; a: array [1..100, 1..100] of integer; begin readln(n);
for i:=1 to n do for j:=1 to n do begin write('a[',i,',',j,']=');
readln(a[i,j]); end; for i:=1 to n do for j:=1 to n do
begin if a[i,j]<=0 then a[i,j]:=0 else a[i,j]:=1 end;
for i:=1 to n do begin for j:=1 to n do write(a[i,j]:3); writeln end; writeln; writeln; for i:=1 to n do begin for j:=1 to i do write(a[i,j]:3);
writeln end end.

Yüklə 1,77 Mb.

Dostları ilə paylaş:
1   ...   70   71   72   73   74   75   76   77   ...   92




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©azkurs.org 2024
rəhbərliyinə müraciət

gir | qeydiyyatdan keç
    Ana səhifə


yükləyin