Friday, 2 November 2012

PROGRAM HITUNG PANGKAT (PASCAL) FUNGSI

Penampakan :

-----------------------------------------------------------------------------------------------------

program hitung_pangkat;
uses crt;
var
a, n : integer;

            function pangkat(x : integer) : real;
            var
               hasil : real;
            begin
                 hasil := exp(x*ln(a));
                 pangkat:=hasil;
            end;

{-Main Program-}

begin
clrscr;

       write('Masukkan angka : ');readln(a);
       write('Dipangkatkan berapa ? ');readln(n);
       writeln('========================');
       writeln('Jadi ',a,'^',n,' adalah ',pangkat(n):2:0);
       writeln('========================');
       writeln('LUTFIBROWN"s SIMPLE CODE');

readln;
end.


No comments:

Post a Comment