Rabu, 13 April 2016

Program pascal 3

1.      Program Perulangan 1
Program Perulangan1;
uses crt;
var n : integer;
begin
write('Jumlah Perulangan= '); readln(n);
repeat
      writeln(n,'. ','Saya Belajar Pascal');
      n:=n+1;
until n>=11;
end.
                                    (Minggu,8 November 2015)


2.      Program Perkalian
Program Perkalian;
uses crt;
var a,b,c:integer;
ulang:char;
begin
repeat
begin
            write('masukkan angka pertama= ');readln(a);
            write('masukkan angka kedua= ');readln(b);
            c:=a*b;
            writeln('Hasil Perkaliannya adalah: ',c);
end;
write('anda ingin mengulang(y/t): '); readln(ulang);
until (ulang='t');
end.
                                    (Senin, 9 November 2015)


3.      Program Tebak Angka
Program TebakAngka;
uses crt;
var kunci,angka:byte;
      ulang:char;
begin
repeat
kunci:=random(5);
      repeat
            write('masukkan angka= '); readln(angka);
      until (kunci=angka);
            begin
                  writeln('selamat anda berhasil');
            end;
write('anda ingin mengulang(y/t): '); readln(ulang);
until(ulang='t');
end.

                                    (Senin, 9 November 2015)

4.      Program Perulangan 4
Program Perulangan4;
uses crt;
var n:integer;
begin
write('Jumlah Perulangan= '); readln(n);
while n<=10 do
     begin
     Writeln(n,'. ','Saya Harus Sukses');
     n:=n+1;
     end;
end.
                                                                        (Selasa, 10 November 2015)
5.      Program Kelipatan5
Program Kelipatan5;
uses crt;
var a:integer;
ulang:char;
begin
repeat
a:=5;
     while a<=50 do
           begin
           writeln(a);
           a:=a+5
           end;
write('apakah anda ingin mengulang(y/t): '); readln(ulang);
until(ulang='t')
end.
(Selasa, 10 November 2015)

6.      Program Perulangan 6
Program Perulangan6;
uses crt;
var n:integer;
begin
for n:=1 to 5 do
     begin
     write(n,'. ');
     writeln('Saya');
     writeln('Belajar');
     writeln('Pascal');
     writeln;
     end;
end.
 
                                (Rabu,11 November 2015)

7.      Program Perulangan 7
Program Perulangan7;
uses crt;
var n:integer;
begin
for n:=5 downto 1 do
     begin
     write(n,'. ');
     writeln('Saya');
     writeln('Belajar');
     writeln('Pascal');
     writeln;
     end;
end.

                                  (Kamis,12 November 2015)
















0 komentar:

Posting Komentar