Senin, 02 April 2012

[Turbo Pascal] Perulangan(1) Dengan Repeat...Until


Program Perulangan;
Uses wincrt;
Var
i,jum,bil,n : Integer;
rata : Real;

Begin
i:= 1;
jum:= 0;
write('Isikan Banyaknya Data : '); Readln(n);
  Begin
    Repeat
    write('Isikan Bilangan ke ',i,' = '); Readln(bil);
    i:= i + 1;
    jum:= jum + bil;
    Until n < i;
  End;
rata:= jum / n;
writeln('Nilai Rata-rata Bilangan = ',rata:0:2);
writeln('Jumlah Bilangan          = ',jum);
End.

Related Articel:

0 komentar:

Posting Komentar

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Affiliate Network Reviews