- PASCAL
program latihan1; uses wincrt; var larik : array[1..1000] of integer; x,y,z : integer; begin z:=0; writeln; write('banyaknya larik = '); readln(x); writeln; if x > 1000 then writeln('maksimal 1000') ; if x<= 1000 then begin writeln('masukan elemen larik'); writeln; for y:=1 to x do begin write('elemen ke-',y,' = ');readln(larik[y]); z:=z+larik[y]; end; writeln('jumlah = ',z); end; end.
0 komentar:
Posting Komentar