This is default featured slide 1 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

This is default featured slide 2 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

This is default featured slide 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

This is default featured slide 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

This is default featured slide 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

Rabu, 13 Januari 2016

Pascal Function

program tes;
uses wincrt;

function pertama(var a, b : integer):integer;
begin
pertama := a*b;
end;

function kedua(var a, b : integer):integer;
begin
kedua := a+b;
end;

function ketiga(var a, b : integer):real;
begin
ketiga := a/b;
end;

function keempat(var a, b : integer):integer;
begin
keempat := a-b;
end;

var
x, y : integer;
a : char;

begin
writeln('------------------------------------------------------');
writeln(' a. perkalian');
writeln(' b. penjumlahan');
writeln(' c. pembagian');
writeln(' d. pengurangan');

writeln('------------------------------------------------------');

write(' Nilai X = ');readln(x);
write(' Nilai Y = ');readln(y);

write(' Pilih = ');readln(a);

if a='a' then

writeln(' hasilnya adalah ',pertama(x,y))
else
if a='b' then
writeln(' hasilnya adalah ',kedua(x,y))
else
if a='c' then
writeln(' hasilnya adalah ',ketiga(x,y):3:2)
else
if a='d' then
writeln(' hasilnya adalah ',keempat(x,y))
else
write(' Inputkan salah ');


end.

Pascal Procedure

program satu;
uses wincrt;

var
 y, z, n : integer;

procedure pertama;
var
 x : integer;

begin
 x := y + z;
 writeln(x);
end;

procedure kedua(b, c : integer);

var
 a : integer;
begin
 a:= b - c;
 writeln(a);
end;

procedure ketiga(d, e, f : integer);
begin
 d:= e * f;
 writeln(d);
end;

begin
 write(' y= ');readln(y);
 write(' z= ');readln(z);
 pertama;
 kedua(y,z);
 ketiga(n,y,z);
end.

Pascal Perulangan Bintang

program soal12;
uses wincrt;

var
a, b : byte;

begin

a:=6;

while a<7 do

begin

b:=1;

while b<a do

begin

write('x');

b := b+1;

end;

a := a-1;
writeln;
end;


readln;

end.

program soal22;
uses wincrt;

var
a, b : byte;

begin

a:=1;

while a<7 do

begin

b:=1;

while b<a do

begin

write('x ');

b := b+1;

end;

a := a+1;
writeln;
end;


readln;

end.

Pascal Perulangan


1. program tugas11;
uses wincrt;

var
a, b : byte;

begin

for a := 1 to 5 do
begin
writeln('   ',a);
b := b+a;
end;
writeln('------ +');
writeln('   ',b);
readln;
end.

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

program tugas12;
uses wincrt;

var
a, b : byte;

begin
a:=1;
b:=0;

while a<6 do

begin

writeln('   ',a);
b := b+a;
a := a+1;


end;

writeln('------ +');
writeln('   ',b);

readln;

end.

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

program tugas13;
uses wincrt;

var
a, b : byte;

begin

a := 1;
b := 0;
begin

repeat

Writeln(a);

b := b+a;
a := a+1;

until a>5;

end;
writeln('------- +');
writeln('   ',b);

readln;

end.


2. program tugas21;
uses wincrt;

var
a, b : byte;

begin

for a := 1 to 10 do
if a mod 2=1 then

begin
writeln('   ',a);
b := b+a;

end;

writeln('------ +');
writeln('   ',b);
readln;

end.

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

program tugas22;
uses wincrt;

var
a, b : byte;

begin
a:=1;
b:=0;

while a<10 do

begin
if a mod 2=1 then
writeln('   ',a);
if a mod 2=1 then
b := b+a;
a := a+1;


end;

writeln('------ +');
writeln('   ',b);

readln;

end.

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

program tugas23;
uses wincrt;

var
a, b : byte;

begin

a := 1;
b := 0;

begin

repeat

if a mod 2=1 then

Writeln('   ',a);
if a mod 2=1 then
b := b+a;
a := a+1;

until a>10;

end;
writeln('------- +');
writeln('   ',b);

readln;

end.


3. program tugas31;
uses wincrt;

var
a, b : byte;

begin

for a := 1 to 5 do
begin
for b := 1 to 3 do
write(b:3);
writeln;
end;

readln;

end.

------------
program tugas32;
uses wincrt;

var
a, b : byte;

begin

a:=1;
b:=1;

while a<6 do

begin

b:=1;

while b<4 do

begin

write(b:3);

b := b+1;

end;

a := a+1;
writeln;
end;


readln;

end.


4. program tugas41;
uses wincrt;

var
a, b : byte;

begin

for a := 1 to 6 do
begin
for b := 1 to a do
write('x');
writeln;
end;

readln;

end.

----------------------
program tugas42;
uses wincrt;

var
a, b : byte;

begin

a:=1;
b:=1;

while a<8 do

begin

b:=1;

while b<a do

begin

write('x');

b := b+1;

end;

a := a+1;
writeln;
end;


readln;

end.


5.program tugas51;
uses wincrt;

var
a, b : byte;

begin

for a := 1 to 5 do
begin
for b := 1 to 3 do
write(a:3);
writeln;
end;

readln;

end.

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

program tugas52;
uses wincrt;

var
a, b : byte;

begin

a:=1;
b:=1;

while a<6 do

begin

b:=1;

while b<4 do

begin

write(a:3);

b := b+1;

end;

a := a+1;
writeln;
end;


readln;

end.

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

program tugas53;
uses wincrt;

var
a, b, c : byte;

begin

a := 1;

repeat

b := 1;

repeat

c := 1;

repeat

Writeln(a:3,b:3,c:3);

b := b+1;
a := a+1;
c := c+1;

until a>5;
until b>5;
until c>5;

readln;

end.


6. program tugas61;
uses wincrt;

var
a, b : byte;

begin

for a := 1 to 5 do
begin
for b := 1 to a do
write(a:3);
writeln;
end;

readln;

end.

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

program tugas62;
uses wincrt;

var
a, b : byte;

begin

a:=0;
b:=0;

while a<6 do

begin

b:=0;

while b<a do

begin

write(a:3);

b := b+1;

end;

a := a+1;
writeln;
end;


readln;

end.