Val_Kir

нулевой v.0.1

Sep 8th, 2017
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 3.31 KB | None | 0 0
  1. {program lab01;
  2.  
  3. var a,b,c : integer;
  4.  
  5.   begin
  6.     writeln('enter the numbers');
  7.     readln(a,b);
  8.     c:=a*b;
  9.     write(c);
  10.     readln; readln;
  11.     end.
  12. }
  13. {
  14. program lab02;
  15.  
  16. var a,b,c,d : integer;
  17.  
  18.   begin
  19.     writeln('enter the numbers');
  20.     readln(a,b);
  21.     c:=a div b;
  22.     d:=a mod b;
  23.     writeln(c,'',d);
  24.     readln; readln;
  25.     end.
  26. }
  27. {
  28. program lab03;
  29.  
  30. var a,b,c: integer;
  31.  
  32. begin
  33.    writeln('enter the numbers');
  34.     readln(a,b,c);
  35.    if (a>b) and (b>c)
  36.       then writeln(c,'',b,'',a);
  37.    if (b>a) and (a>c)
  38.       then writeln(c,'',a,'',b);
  39.    if (b>c) and (c>a)
  40.       then writeln(a,'',c,'',b);
  41.    if (c>b) and (b>a)
  42.       then writeln(a,'',b,'',c);
  43.    if (a>c) and (c>b)
  44.       then writeln(b,'',c,'',a);
  45.    if (c>a) and (a>b)
  46.       then writeln(b,'',a,'',c);
  47.    readln; readln;
  48. end.
  49. }
  50. {
  51. program lab04;
  52.  
  53. var c1,c2,r,x,y:real;    //c1 - x, c2 - y
  54.  
  55.   begin
  56.     c1:=1;
  57.     c2:=2;
  58.     r:=2;
  59.     x:=1;
  60.     y:=1;
  61.     if (c1+r>x) and (c2+r>y)
  62.       then writeln('Yes, the point belongs to the circle')
  63.       else writeln('No, the point does not belong to a circle');
  64.     readln;
  65.   end.
  66. }
  67. {
  68. program lab05;
  69.  
  70. var n,a:longint;
  71.  
  72.   begin
  73.     writeln('check whether the number is a power of 2');
  74.     readln(n);
  75.     a:=2;
  76.     while a<n do
  77.     a:=a*2;
  78.     if a=n then write('yes, the number is poweer of 2')
  79.     else write ('no, the number is not a power of 2');
  80.     readln;
  81.   end.
  82. }
  83. {
  84. program lab06;
  85.  
  86. var  a,b,count: integer;
  87.  
  88.   begin
  89.     writeln('enter the numbers: ');
  90.     readln(a,b);
  91.     while(a-b>=0) do
  92.       begin
  93.         a:=a-b;
  94.         count:=count+1;
  95.       end;
  96.     writeln('the whole part of the private: ', count);
  97.     writeln('remainder of the division: ', a);
  98.     readln;
  99.   end.
  100. }
  101. {
  102. program lab07;
  103.  
  104. const N=10;
  105. var a: array[1..N] of integer;
  106.   min,max,i: byte;
  107.   b: integer;
  108.  
  109.   begin
  110.     randomize;
  111.     for i:=1 to N do
  112.       begin
  113.         a[i]:=random(100);
  114.         writeln(a[i],'');
  115.       end;
  116.     writeln;
  117.     min:=1;
  118.     max:=1;
  119.     for i:=2 to N do
  120.       begin
  121.         if a[i]<a[min]
  122.         then min:=i;
  123.         if a[i]>a[max]
  124.         then max:=i;
  125.       end;
  126.     writeln('a[',min,']= ', a[min],', ', 'a[',max,']= ', a[max]);
  127.     writeln;
  128.     b:=a[min];
  129.     a[min]:=a[max];
  130.     a[max]:=b;
  131.     for i:=1 to N do
  132.       writeln(a[i],'');
  133.     readln;
  134.     end.
  135. }
  136.  
  137. program lab08;
  138. const nmax = 10;
  139.  
  140. type matrix = array[1..nmax, 1..nmax] of integer;
  141.  
  142. procedure fill(var mas: matrix; const n: integer);
  143. var
  144.   i, j: integer;
  145. begin
  146.   for i := 1 to n do
  147.     for j := 1 to n do
  148.       mas[i, j] := random(20);
  149. end;
  150.  
  151. procedure conclusion(const mas: matrix; const n: integer);
  152. var
  153.   i, j: integer;
  154. begin
  155.   for i := 1 to n do
  156.   begin
  157.     for j := 1 to n do
  158.       write(mas[i, j]:4);
  159.     writeln;
  160.   end;
  161. end;
  162.  
  163. procedure search(const mas: matrix; const n: integer; var x, y: integer);
  164. var
  165.   i, j, min: integer;
  166. begin
  167.   min := mas[1, 1];
  168.   for i := 1 to n do
  169.     for j := 1 to n do
  170.       if min > mas[i, j] then
  171.       begin
  172.         min := mas[i, j];
  173.         x := j;
  174.         y := i;
  175.       end;
  176. end;
  177.  
  178. var
  179.   n, x, y: integer;
  180.   mas: matrix;
  181.  
  182. begin
  183.   readln(n);
  184.   fill(mas, n);
  185.   conclusion(mas, n);
  186.   search(mas, n, x, y);
  187.   writeln('the minimum element in ', x, ' the column, ', y, ' row.');
  188.   readln;
  189. end.
Add Comment
Please, Sign In to add comment