SHARE
TWEET

Untitled

a guest Nov 29th, 2015 195 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var a:array[1..100,1..100] of real;
  2.     b,x:array[1..100] of real;
  3.     i,j,k,n:integer;
  4.     z,r,g:real;
  5. begin
  6. write('Vvedite kol-vo uravneniy: ');
  7. read(n);
  8. for i:=1 to n do begin
  9.   writeln('Uravnenie ',i);
  10.   writeln('Vvedite koefficienty');
  11.   for j:=1 to n do begin
  12.       write('a[',i,',',j,']=');
  13.       read(a[i,j]);
  14.      end;
  15.   writeln('Vvedite pravuyu chast uravneniya');
  16.   write('b[',i,']=');
  17.   read(b[i]);
  18.   end;
  19. writeln('Matrica:');
  20. for i:=1 to n do
  21.  begin
  22.   for j:=1 to n do
  23.   write(a[i,j]:8:2);
  24.   writeln(b[i]:8:2);
  25.   end;
  26. for k:=1 to n do
  27.      begin
  28.        for j:=k+1 to n do
  29.           begin
  30.             r:=a[j,k]/a[k,k];
  31.             for i:=k to n do
  32.                begin
  33.                  a[j,i]:=a[j,i]-r*a[k,i];
  34.                end;
  35.             b[j]:=b[j]-r*b[k];
  36.           end;
  37.      end;
  38. for k:=n downto 1 do
  39.      begin
  40.        r:=0;
  41.        for j:=k+1 to n do
  42.          begin
  43.            g:=a[k,j]*x[j];
  44.            r:=r+g;
  45.          end;
  46.       x[k]:=(b[k]-r)/a[k,k];
  47.      end;
  48. writeln('Korni sistemy uravneniy:');
  49. for i:=1 to n do
  50. write('x[',i,']=',x[i]:0:2,'   ');
  51. readln;
  52. end.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top