Minggu, 22 April 2012

Program Jumlah_Kolom_Baris_matriks; ( Algoritma dan Pemograman )


Program Jumlah_Kolom_Baris_matriks;
uses crt;
type
  matriks = array[1..50,1..50] of integer;
var
  a   : matriks;
  x,y,i,j : integer;

begin
  write('baris : ');readln(x);
  write('kolom : ');readln(y);
  window(5,7,35,17);textbackground(1);clrscr;
  textcolor(7);
  gotoxy(12,1);write('Matriks A');
  gotoxy(12,2);write('=========');
  for i := 1 to x do
  begin
    for j := 1 to y do
      begin
        gotoxy(j*5,i+2);readln(A[i,j]);
      end;
    end;

  for i := 1 to x do
   begin
    A [i,y+1]:= 0;
      for j := 1 to y do
      begin
        A[i,y+1] := A[i,y+1] + A[i,j];
        end;
        gotoxy(j*6,i+2);writeln(A[i,y+1]);
        end;


  for j := 1 to y do
  begin
    a[x+1,j]:= 0;
      for i := 1 to x do
      begin
        a[x+1,j] := a[i,j] + A[x+1,j];
             end;
         gotoxy(j*5,i+4);writeln(a[x+1,j]);

           end;

readln;
end.

Tidak ada komentar:

Posting Komentar