Studi Kasus :
1 2 3 4 5 6
7 8 9 10 11 12
6 5 4 3 2 1
1 7 1 2 8 9
0 3 1 0 9 0
2 0 0 9 9 8
Jawaban :
program
hitung;
var
a,n,d,i,t,o,g,total:integer;
a:array[1..6,1..6]
of integer;
begin
writeln('programhitungperjumlahanmatrik');
writeln();
d:=0;
i:=0;
t:=0;
o:=0;
g:=0;
for a:=1 to 6 do
for n:=1 to 6 do
begin
write('Masukannilaia[',a,',',n,']= ');
readln(a[a,n]);
if a=1 then
d:=k+a[a,n];
ifa=1 then
i:=i+a[a,n];
if a+n=7 then
t:=t+a[a,n];
if a=6 then
o:=o+a[a,n];
if a=6 then
g:=g+a[a,n];
end;
total:=d+i+t+o+g;
writeln;
for a:=1 to 6 do
begin
for n:=1 to 6 do
write(a[a,n]:5);
writeln;
end;
writeln(total);
end
0 comments:
Posting Komentar