Advertisement
Guest User

Untitled

a guest
Nov 20th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.79 KB | None | 0 0
  1. Program Ex1;
  2. const n=10;
  3. type matrix= array [1..n, 1..n] of real;
  4. var a,b,c:matrix;
  5. i,j,k:integer;
  6. Begin
  7. randomize;
  8. for i:= 1 to n do //перебор строк
  9. for j:= 1 to n do //перебор столбцов
  10. a[i,j]:= random (10);
  11. Writeln ('matrix A');
  12. for i:=1 to n do begin
  13. for j:= 1to n do
  14. write(a[i,j]:8:2);
  15. writeln('');
  16. end;
  17. for i:= 1 to n do //перебор строк
  18. for j:= 1 to n do //перебор столбцов
  19. b[i,j]:= random (10);
  20. Writeln ('matrix B');
  21. for i:=1 to n do begin
  22. for j:= 1to n do
  23. write(b[i,j]:8:2);
  24. writeln('');
  25. end;
  26. for i:=1 to n do
  27. for j:=1 to n do begin
  28. c[i,j]:=0;
  29. for k:=1 to n do
  30. c[i,j]:=c[i,j]+a[i,k]*b[k,j];
  31. end;
  32. writeln('matrix C');
  33. for i:=1 to n do begin
  34. for j:= 1to n do
  35. write (c[i,j]:8:2);
  36. writeln;
  37. end;
  38. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement