Advertisement
kirya_shkolnik

11var 5МП 3 задача

May 14th, 2021
2,784
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scilab 0.71 KB | None | 0 0
  1. // Сценарий Pr1_5_3.sce
  2. function b = posl(M)
  3.     [m,n] = size(M);
  4.     d = M(1,2) - M(1,1);
  5.     b = 1
  6.     for i=1:n
  7.         if M(1,n) - M(1,n-1) ~= d then
  8.             b = 0;
  9.         end
  10.     end
  11. endfunction
  12. function mas=task(M)
  13.     [m,n] = size(M);
  14.     c = 1;
  15.     mas = zeros(m,n);
  16.     for i=1:m
  17.         if posl(M(i,:)) == 1 then
  18.             mas(c,:) = M(i,:);
  19.             c=c+1;
  20.         end
  21.     end
  22.     for i=c:m;
  23.         mas(i,:) = [];
  24.     end
  25. endfunction
  26.  
  27. M = input("Введите матрицу  ");
  28. disp("Начальная матрица", M);
  29. C = task(M);
  30. disp("Результат", C);
  31.  //Конец сценария Pr1_5_3.sce
  32. //==========================================
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement