Jumat, 19 April 2013

Program Pascal Rata-rata Bilangan Menggunakan Array


Program array_rata_bilangan;
Uses wincrt;
Var
   s:array [1..100] of 0..100;
   n,i:integer;
   rata2,jum:real;
Begin
     Write('Banyaknya bilangan:');
     Readln(n);
     For i:=1 to n do
     Begin
          Clrscr;
          Write('Bilangan ke',i,':');
          Readln(s[i]);
     End;
     Clrscr;
     Writeln('NO','BILANGAN':10);
     For i:=1 to n do
     Begin
          Writeln(i,'.',s[i]:7);
          Jum:=jum+s[i];
     End;
     Rata2:=jum/n;
     Write('rata-rata :',rata2:2:2);
End.

1 komentar:

Posting Komentar

You can replace this text by going to "Layout" and then "Page Elements" section. Edit " About "

Baca Selengkapnya Di : http://indonesianblog-jmk.blogspot.com/2012/06/cara-membuat-komentar-admin-berbeda.html#ixzz2kb6khEJE