1 / 7

ALGORITMA & PEMROGRAMAN

ALGORITMA & PEMROGRAMAN. Tegal , 16 DESEMBER 2011. Khairul Fahmi fahmikhairul@gmail.com. CONTOH PROGRAM. 1. Membuat Program Menghitung Luas Persegi Panjang Program LuasPersegiPanjang ; Var panjang,lebar,luas : integer; Begin write(‘ Masukkan panjang = ‘); readln ( panjang );

galya
Download Presentation

ALGORITMA & PEMROGRAMAN

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ALGORITMA & PEMROGRAMAN Tegal, 16 DESEMBER 2011 KhairulFahmi fahmikhairul@gmail.com

  2. CONTOH PROGRAM 1. Membuat Program MenghitungLuasPersegiPanjang Program LuasPersegiPanjang; Varpanjang,lebar,luas : integer; Begin write(‘Masukkanpanjang = ‘); readln(panjang); write(‘Masukkanlebar = ‘); readln(lebar); luas := panjang * lebar; Writeln(‘LuasPersegiPanjang = ‘,luas); End.

  3. CONTOH PROGRAM 2. Membuat Program UntukMenampilkanKode Pos DenganMenyebutkanNama Kota. Padang : 25000 Bandung : 40100 Solo : 51000 Denpasar : 72000 Palu : 92300

  4. CONTOH PROGRAM Program KodePos Varkode: integer; kota : string; Begin write(‘Masukkankota = ‘); readln(kota); if kota = ‘Padang’ then begin kode:= 25000; end else if kota = ‘Bandung’ then begin kode :=40100; end else if kota = ‘Solo’ then begin kode:= 51000; end else if kota = ‘Denpasar’ then begin kode:= 72000 end else if kota = ‘Palu’ then begin kode := 92300; end; Write( ‘Kode Pos =‘, kode); End.

  5. CONTOH PROGRAM Program Bil_genap_ganjil Var bil : integer; I : integer; Begin for I := 0 to 10 do begin Write(‘Ketikkanbilangansembarang’); Readln(bil); if bil mod 2 =0 then begin Write(‘Bilangangenap’); end else begin Write(‘Bilanganganjil’); end; readln; end; End.

  6. LATIHAN Buatlah Program Konversi Dari Jam KeDetik. Buatlah Program Konversi Dari CelciusKe Fahrenheit danReamur. Fahrenheit = (Celcius x 1,8) + 32 Reamur = Celcius x 0,8 Buatlah Program MenampilkanlaguAnakAyamMenggunakanPengulangan. GabungkanlahKe 3 Program DiatasMenjadiSatu Program DenganMenggunakanPemilihan.

  7. TerimaKasih KhairulFahmi fahmikhairul@gmail.com 085718295334

More Related