Bitlab Developers
  • Introduction
  • 🐧Linux
    • Perkenalan Linux
    • DVWA: Install On Kali Linux
    • MYSQL: Kali Linux
    • How To Add Apps In Kali Linux
    • Initial Linux Installation
    • Linux: Fundamentals
    • Linux: Privilege Escalation
  • 💾HackLovers ID
    • Penestration Testing
    • Check Kerentanan Manual
    • Security Models
    • Pentesting Fundamentals
    • Metodologi Hacking
      • Metodologi By Anonputraid
    • Scope Penestration
    • Pengumpulan Informasi
    • 📑Learning Path !
  • SQL Injection
    • Perkenalan SQL-Injection
    • Examining the Database
    • Cheat Sheet
    • Union Attack
    • Subverting application logic
    • Retrieving Hidden Data
    • Blind vulnerabilities
      • Blind SQL-Injection: Triggering Conditional Responses
      • Blind SQL injection: Triggering Time Delays
      • Blind SQL Injection: Triggering SQL Errors
      • Blind SQL injection: Out Of Band (OAST)
  • ⚡Networking
    • Network Fundamental
  • Burp-Suite
    • Burp Suite: List
    • Burp Suite: Profesional Install
    • Burp Suite: The Basic
      • Burp Suite: What is Burp Suite?
      • Burp Suite: How To install
      • Burp Suite: The Dashboard
      • Burp Suite: Navigation
      • Burp Suite: Introduction to the Burp Proxy
      • Burp Suite: Connecting through the Proxy (FoxyProxy)
      • Burp Suite: Proxying HTTPS
      • Burp Suite: The Burp Suite Browser
      • Burp Suite: Scoping and Targeting
      • Burp Suite: Site Map and Issue Definitions
      • Burp Suite: Example Attack
    • Burp Suite: Repeater
      • Burp Suite: What is Repeater?
      • Burp Suite: Basic Usage
      • Burp Suite: Inspector
      • Burp Suite: Views
      • Burp Suite: Challenge
      • Burp Suite: SQLi with Repeater
    • Overview of Burp Suite
      • 📋Burp Suite: Anonputraid Tips
        • Burp Suite: Cross-Site Scripting
  • 🤖Hackthebox
    • Pekernalan Hackthebox
    • Hackthebox Machines
    • Tips & Trick
      • Basic Web Enumeration
      • SSRF & CRLF Attacks
      • Metasploit MsfVenom Apk
      • HashCat: Rules Type Base64
      • Forensic Knowledge
      • Gitlab Laboratory
      • Proxychains & DNS
  • Tryhackme
    • Perkenalan Try Hack Me
    • Learning Path
  • 🖥️Mac Os
    • Catalina Tools
      • Visual Studio Code
    • Dual Boot Kali Linux On Mac
    • How To Change Theme Refind
    • How To Remove Refind
    • Tips to Beautify Terminal
    • Macos For Hacking
    • How To Change Icon Macos
  • Pascal
    • Learning Path
    • Struktur Program Pascal
      • Judul program
      • Bagian Pernyataan/Terproses
      • Bagian Deklarasi
        • Deklarasi prosedur dan Fungsi
        • Deklarasi variabel/perubah
        • Deklarasi Tipe
        • Deklarasi Label
        • Deklarasi Konstanta
    • The Basic
      • Tipe Data
        • Tipe Data standar
          • Tipe Data Integer
          • Tipe data real
          • Tipe Data Karakter
          • Tipe Data String
          • Tipe Sata Boolean
        • Tipe Data Terdefinisi
          • Tipe Data Subjangkauan
          • Tipe Data Terbilang
          • Tipe Data Larik (array)
          • Tipe data record dan file
      • Statemen-statemen
        • Reserved Word
      • Perintah Perintah
        • Statemen Input/output
          • Read/readln(Prosedur)
          • ReadKey(fungsi)
          • Write/writeln(prosedur)
        • Statemen Pengaturan Letak Di Layer
          • Clrscr(prosedur)
          • Gotoxy(prosedur)
          • Delline(prosedur)
          • Insline(prosedur)
          • Delay(prosedur)
        • Statemen Memanipulasi String
          • Concat(fungsi)
          • Copy(fungsi)
          • Delete(prosedur)
          • Insert(Prosedur)
          • Length(fungsi)
          • Pos(fungsi)
          • Str(prosedur)
          • Val(prosedur)
          • Upcase(fungsi)
        • Statemen Perhitungan Aritmatik
          • Abs(Fungsi)
          • Arctan(fungsi)
          • Cos(fungsi)
          • Exp(fungsi)
          • Frac(fungsi)
          • Int(fungsi)
          • LN(fungsi)
          • Sin(fungsi)
          • Sqr(fungsi)
          • SQRT(fungsi)
        • Statemen Transfer Nilai Dari Suatu Variable
          • Chr(fungsi)
          • Ord(fungsi)
          • Round(fungsi)
          • Trunc(fungsi)
        • Statemen Memanipulasi Data
          • Pred(fungsi)
          • Succ(fungsi)
          • INC(fungsi)
          • DEC(fungsi)
        • Statemen Tambahan (warna,suara dan window)
          • Sound(prosedur)
          • TextMode(prosedur)
          • Window(prosedur)
          • Textbackground(prosedur)
          • TextColor(prosedur)
      • Bentuk Perulangan
        • Perulangan FOR
          • Perulangan FOR negatif
          • Perulangan FOR positif
          • Perulangan FOR tersarang
        • Perulangan WHILE-DO
      • Record
        • Deklarasi Record
        • Statemen with
        • Record Dalam Array
        • Field Record Bertipe Array
        • Tipe Data Record Dengan Field Tipe Record
      • Procedure
        • Template Latihan Proseduce
        • Parameter Dalam Procedure
        • Pengiriman parameter Secara Nilai
        • Pengiriman Parameter Secara Acuan (By Reference)
        • Procedure Memanggil Procedure Yang Lain
        • Procedure Tersarang
        • Procedure Memanggil Dirinya Sendiri (Rekursi)
      • Function
        • Rekursi Pada Function
        • Parameter Nilai Dalam Function
        • Function Dengan Parameter Acuan
        • Function tanpa parameter
      • File Teks
        • Membuat File Teks
        • Deklarasi File Teks
        • Pernyataan Rese
        • Pernyataan Rewrite
        • Pernyataan Close
      • File Binary
      • Pascal Library
        • Free Pascal Game
        • SDL: Simple DirectMedia Layer
          • SDL: Language Bindings
        • How To Install ?
      • Pascal Examples
        • Pascal Exercises
          • Exersices 1
          • Exersices 2
          • Exersices 3
          • Exersices 4
        • Pascal Quiz
          • Question 1
      • Perkenalan Pascal
  • Dart Programming
    • Install Dart On Linux
  • ⚙️Technical
    • Pengantar Sistem Informasi
    • Perkenalan UEFI & Legacy
  • Git Dan Github
    • Download Git & Setting
    • Membuat Portofolio GitHub
  • Xampp
    • Error Mysql Xampp
Powered by GitBook
On this page

Was this helpful?

  1. Pascal
  2. The Basic
  3. Pascal Examples
  4. Pascal Exercises

Exersices 1

Dosen : Elisawati, S.Kom, M.Kom

Buatlah program dibawah ini dengan menggunakan tampilan 2 windows , windows sebelah Kiri Sebagai Input dan Windows Sebelah Kanan sebagai Output, Textcolor, Textbackground, Gotoxy, dan Sound untuk memperindah tampilan.

  1. Mengubah derajat temperatur, dari derajat Celcius ke derajat Fahreinheit dan Reamur (derajat Celcius diinput

  2. Menghitung Luas dan Keliling lingkaran, dengan jari-jari diketahui (diinput).

  3. Menghitung Luas dan Keliling segitiga sembarang yang diketahui ke tiga sisinya.

  4. Mencari nilai Sinus, Cosinus, dan Tangen dengan sudut diinput.

  5. Mencari akar dan kuadrat dari suatu nilai (nilai diinput).

  6. Mencari nilai bulat dan pecahan dari suatu nilai yang dimasuk kan melalui keyboard (diinput). Nilai pecahan tersebut dibulatkan sampai 3 angka dibelakang koma (,).

Jawaban :

Aritmatika.pas
Program Aritmatika;
uses crt;

var
    a,ui : INTEGER; a1,a2,a3,b1 : REAL;

Label 
    screen,main,menu,input,output,input2,output2,
    input3,output3,input4,output4,input5,output5,
    input6,output6;

procedure fahrenheit;

    var
    f : real;

    begin
    f := 1.8 * ui + 32;
    GOTOXY(41,2);writeln(' Suhu Fahreinheit ==> ',f:0:2);
    end;

procedure reamur;
    var
    r : real;
    begin
    r := 0.8 * ui + 32;
    GOTOXY(41,3);writeln(' Suhu Reamur ==> ',r:0:2);
    end;

procedure Lingkaran;

    Var 
        Keliling : REAL;
        Luas : REAL;
    begin
    Luas := 3.14*ui*ui;
    GOTOXY(41,2); writeln(' Luasnya     : ', Luas:9:2);
    keliling:=2*3.14*ui;
    GOTOXY(41,3); writeln(' Kelilingnya : ', keliling:9:2);
    end;

procedure Segitiga;
var
    a,luas : real;
begin
    a := sqrt(sqr(a1) + sqr(a2) -2 * a1 * a2 *cos(a3 / 57.2958));
    luas := 0.5 * a1 * a2 * sin(a3 / 57.2958);
    GOTOXY(41,2); writeln(' Luas Segitiga    = ', luas:8:2);
    GOTOXY(41,3); writeln(' Panjang Segitiga = ', a:8:2);
    
    
end;

procedure cosinus;
begin
    GOTOXY(41,2); Write(' 1. Sinus   : ', SIN(ui):9:3);
    GOTOXY(41,3); Write(' 2. Cosinus : ', COS(ui):9:3);
    GOTOXY(41,4); write(' 3. Tangen  : ', ARCTAN(ui):9:3);
end;


procedure akar;
begin
    GOTOXY(41,2); writeln(' Nilai X dipangkatkan : ', SQR(ui));
    GOTOXY(41,3); writeln(' Nilai X diakarkan : ', SQRT(ui):1:0);

end;

procedure bulat;
begin
    
    GOTOXY(41,2); writeln(' Bilangan Bulatnya : ', INT(b1):5:2);
    GOTOXY(41,3); writeln(' Bilangan Pecahan  : ', FRAC(b1):5:3);
end;


begin
    repeat
    goto screen;
    screen:
        clrscr;
        goto menu;
    menu: { Tampilan Menu }
        textbackground(red);
        textcolor(white);
        window(1,3,80,13); 
        gotoxy(10,1); write(' Aritmatika ');
        textbackground(0);
        textcolor(black); textbackground(green);
        GOTOXY(1,3);   write(' Menu ');
        textcolor(green); textbackground(0);
        GOTOXY(1,4);   write('1. Mengubah Derajat Temperatur !');
        GOTOXY(1,5);   write('2. Hitung Luas dan Keliling lingkaran');
        GOTOXY(1,6);   write('3. Hitung Luas dan Keliling segitiga');
        GOTOXY(1,7);   write('4. Nilai Sinus, Cosinus, dan Tangen');
        GOTOXY(1,8);   write('5. Akar dan kuadrat dari suatu nilai ');
        GOTOXY(1,9);   write('6. Nilai Bulat Dan Pecahan');
        goto main;
        
    main: { Tampilan Deskripsi }
        textbackground(blue);
        textcolor(white);
        gotoxy(50,1); write(' STMIK DUMAI ');
        textbackground(0);
        textcolor(black); textbackground(green);
        gotoxy(40,3);   write(' Deskripsi ');
        textcolor(green); textbackground(0);
        gotoxy(40,4);   write('');
        gotoxy(40,5);   write('Nama  : Anda');
        gotoxy(40,6);   write('NIM   : Anda');
        gotoxy(40,7);   write('Prodi : Teknik Informatika');
        gotoxy(40,8);   write('Dosen : Elisawati, M.kom');
        gotoxy(40,9);   write('');
        gotoxy(40,10);  write(''); 
        GOTOXY(1,10);   write('Please Select : ');  readln(a);
    until (a = 1) or (a = 2) or (a = 3) or (a = 4) or (a = 5) or ( a = 6);

    if (a = 1) THEN { Algoritma Latihan 1 }
        begin
            clrscr;
            goto input;
            input:
                window(1,3,40,13); { Tampilan Window Untuk Input }
                textbackground(red);
                textcolor(white);
                GOTOXY(10,1); write(' Temperature input ');
                textbackground(0); textcolor(green);
                GOTOXY(1,3);  write(' Masukan Suhu: '); readln(ui);
                goto output;

            output:
                window(40,3,80,13); { Tampilan Window Untuk Output }
                textbackground(blue);
                textcolor(white);
                GOTOXY(10,1); write(' HASIL ');
                textbackground(0); textcolor(green);
                fahrenheit; reamur;

                window(1,3,80,13);
                GOTOXY(1,11); write(' Press Enter To Continue...');readln();
                
                goto screen;
        end;
    
    if (a = 2) THEN { Algoritma Latihan 2 }
        begin
            clrscr;
            goto input2;
            input2:
                window(1,3,40,13); { Tampilan Window Untuk Input }
                textbackground(red);
                textcolor(white);
                GOTOXY(10,1); write(' Calculator Input ');
                textbackground(0); textcolor(green);
                GOTOXY(1,3);  write(' Masukan Lingkaran: '); readln(ui);
                goto output2;

            output2:
                window(40,3,80,13); { Tampilan Window Untuk Output }
                textbackground(blue);
                textcolor(white);
                GOTOXY(10,1); write(' HASIL ');
                textbackground(0); textcolor(green);
                Lingkaran;

                window(1,3,80,13);
                GOTOXY(1,11); write(' Press Enter To Continue...');readln();
                
                goto screen;
        end;
    
    if (a = 3) THEN { Algoritma Latihan 3 }
        begin
            clrscr;
            goto input3;
            input3:
                window(1,3,40,13); { Tampilan Window Untuk Input }
                textbackground(red);
                textcolor(white);
                GOTOXY(10,1); write(' Calculator Input ');
                textbackground(0); textcolor(green);
                GOTOXY(1,3);  write(' Luas Sisi 1 : '); readln(a3);
                GOTOXY(1,4);  write(' Luas Sisi 2 : '); readln(a1);
                GOTOXY(1,5);  write(' Luas Sisi 3 : '); readln(a2);
                goto output3;

            output3:
                window(40,3,80,13); { Tampilan Window Untuk Output }
                textbackground(blue);
                textcolor(white);
                GOTOXY(10,1); write(' HASIL ');
                textbackground(0); textcolor(green);
                Segitiga;

                window(1,3,80,13);
                GOTOXY(1,11); write(' Press Enter To Continue...');readln();
                
                goto screen; 
        end;
    
    if (a = 4) THEN { Algoritma Latihan 4}
        begin
            clrscr;
            goto input4;
            input4:
                window(1,3,40,13); { Tampilan Window Untuk Input }
                textbackground(red);
                textcolor(white);
                GOTOXY(10,1); write(' Calculator Input ');
                textbackground(0); textcolor(green);
                GOTOXY(1,3);  write(' Masukkan Nilai : '); readln(ui);
                goto output4;

            output4:
                window(40,3,80,13); { Tampilan Window Untuk Output }
                textbackground(blue);
                textcolor(white);
                GOTOXY(10,1); write(' HASIL ');
                textbackground(0); textcolor(green);
                cosinus;

                window(1,3,80,13);
                GOTOXY(1,11); write(' Press Enter To Continue...');readln();
                
                goto screen;  
        end;
    
    if (a = 5) THEN { Algoritma Latihan 5}
        begin
            clrscr;
            goto input5;
            input5:
                window(1,3,40,13); { Tampilan Window Untuk Input }
                textbackground(red);
                textcolor(white);
                GOTOXY(10,1); write(' Calculator Input ');
                textbackground(0); textcolor(green);
                GOTOXY(1,3);  write(' Masukkan Nilai Dari X :  '); readln(ui);
                goto output5;

            output5:
                window(40,3,80,13); { Tampilan Window Untuk Output }
                textbackground(blue);
                textcolor(white);
                GOTOXY(10,1); write(' HASIL ');
                textbackground(0); textcolor(green);
                akar;

                window(1,3,80,13);
                GOTOXY(1,11); write(' Press Enter To Continue...');readln();
                
                goto screen; 
        end;
    
    if (a = 6) THEN {Algoritma Latihan 6}
        begin
            clrscr;
            goto input6;
            input6:
                window(1,3,40,13); { Tampilan Window Untuk Input }
                textbackground(red);
                textcolor(white);
                GOTOXY(10,1); write(' Calculator Input ');
                textbackground(0); textcolor(green);
                GOTOXY(1,3);  write(' Masukkan Nilai :  '); readln(b1);
                goto output6;

            output6:
                window(40,3,80,13); { Tampilan Window Untuk Output }
                textbackground(blue);
                textcolor(white);
                GOTOXY(10,1); write(' HASIL ');
                textbackground(0); textcolor(green);
                bulat;

                window(1,3,80,13);
                GOTOXY(1,11); write(' Press Enter To Continue...');readln();
                
                goto screen; 
        end;

end.

Last updated 3 years ago

Was this helpful?