Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {program lab01;
- var a,b,c : integer;
- begin
- writeln('enter the numbers');
- readln(a,b);
- c:=a*b;
- write(c);
- readln; readln;
- end.
- }
- {
- program lab02;
- var a,b,c,d : integer;
- begin
- writeln('enter the numbers');
- readln(a,b);
- c:=a div b;
- d:=a mod b;
- writeln(c,'',d);
- readln; readln;
- end.
- }
- {
- program lab03;
- var a,b,c: integer;
- begin
- writeln('enter the numbers');
- readln(a,b,c);
- if (a>b) and (b>c)
- then writeln(c,'',b,'',a);
- if (b>a) and (a>c)
- then writeln(c,'',a,'',b);
- if (b>c) and (c>a)
- then writeln(a,'',c,'',b);
- if (c>b) and (b>a)
- then writeln(a,'',b,'',c);
- if (a>c) and (c>b)
- then writeln(b,'',c,'',a);
- if (c>a) and (a>b)
- then writeln(b,'',a,'',c);
- readln; readln;
- end.
- }
- {
- program lab04;
- var c1,c2,r,x,y:real; //c1 - x, c2 - y
- begin
- c1:=1;
- c2:=2;
- r:=2;
- x:=1;
- y:=1;
- if (c1+r>x) and (c2+r>y)
- then writeln('Yes, the point belongs to the circle')
- else writeln('No, the point does not belong to a circle');
- readln;
- end.
- }
- {
- program lab05;
- var n,a:longint;
- begin
- writeln('check whether the number is a power of 2');
- readln(n);
- a:=2;
- while a<n do
- a:=a*2;
- if a=n then write('yes, the number is poweer of 2')
- else write ('no, the number is not a power of 2');
- readln;
- end.
- }
- {
- program lab06;
- var a,b,count: integer;
- begin
- writeln('enter the numbers: ');
- readln(a,b);
- while(a-b>=0) do
- begin
- a:=a-b;
- count:=count+1;
- end;
- writeln('the whole part of the private: ', count);
- writeln('remainder of the division: ', a);
- readln;
- end.
- }
- {
- program lab07;
- const N=10;
- var a: array[1..N] of integer;
- min,max,i: byte;
- b: integer;
- begin
- randomize;
- for i:=1 to N do
- begin
- a[i]:=random(100);
- writeln(a[i],'');
- end;
- writeln;
- min:=1;
- max:=1;
- for i:=2 to N do
- begin
- if a[i]<a[min]
- then min:=i;
- if a[i]>a[max]
- then max:=i;
- end;
- writeln('a[',min,']= ', a[min],', ', 'a[',max,']= ', a[max]);
- writeln;
- b:=a[min];
- a[min]:=a[max];
- a[max]:=b;
- for i:=1 to N do
- writeln(a[i],'');
- readln;
- end.
- }
- program lab08;
- const nmax = 10;
- type matrix = array[1..nmax, 1..nmax] of integer;
- procedure fill(var mas: matrix; const n: integer);
- var
- i, j: integer;
- begin
- for i := 1 to n do
- for j := 1 to n do
- mas[i, j] := random(20);
- end;
- procedure conclusion(const mas: matrix; const n: integer);
- var
- i, j: integer;
- begin
- for i := 1 to n do
- begin
- for j := 1 to n do
- write(mas[i, j]:4);
- writeln;
- end;
- end;
- procedure search(const mas: matrix; const n: integer; var x, y: integer);
- var
- i, j, min: integer;
- begin
- min := mas[1, 1];
- for i := 1 to n do
- for j := 1 to n do
- if min > mas[i, j] then
- begin
- min := mas[i, j];
- x := j;
- y := i;
- end;
- end;
- var
- n, x, y: integer;
- mas: matrix;
- begin
- readln(n);
- fill(mas, n);
- conclusion(mas, n);
- search(mas, n, x, y);
- writeln('the minimum element in ', x, ' the column, ', y, ' row.');
- readln;
- end.
Add Comment
Please, Sign In to add comment