Pages

Minggu, 22 Mei 2011

TUGAS :: HAL.3 LATIHAN 1

  • 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. 
  • HASIL
Print Friendly and PDF

Artikel Terkait:

0 komentar:

Posting Komentar

Related Posts Plugin for WordPress, Blogger...