PROGRAM DERET ARITMATIKA DALAM PASCAL

program deret_aritmatika;

uses wincrt;

var

a,b,n,u:integer;

s:real;

begin

writeln(‘PROGRAM DERET ARITMATIKA’);

writeln(‘————————‘);

write(‘a =’);readln(a);

write(‘b =’);readln(b);

write(‘n =’);readln(n);

s:=n*((2*a)+((n-1)*b))/2;

u:=a+((n-1)*b);

writeln(‘Un=’,u);

writeln(‘Sn=’,s:10:2);

end.

Iklan

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout /  Ubah )

Foto Google+

You are commenting using your Google+ account. Logout /  Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout /  Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout /  Ubah )

Connecting to %s

%d blogger menyukai ini: