1 / 9

Pemrograman Dasar Pertemuan Ke-5

Pemrograman Dasar Pertemuan Ke-5. IT- SainTec -UIN. Latihan Yu…. Buat Program berikut : Logika AND (BBB, BSS, SBS, SSS) Logika OR (BBB, BSB, SBB, SSS) Logika NAND (BBS, BSB, SBB, SSB) Logika NOR (BBS, BSS, SBS, SSB) Logika XOR (BBS, BSB, SBB, SSS)

ethel
Download Presentation

Pemrograman Dasar Pertemuan Ke-5

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. PemrogramanDasarPertemuan Ke-5 IT-SainTec-UIN

  2. Latihan Yu… • Buat Program berikut: • Logika AND (BBB, BSS, SBS, SSS) • Logika OR (BBB, BSB, SBB, SSS) • Logika NAND (BBS, BSB, SBB, SSB) • Logika NOR (BBS, BSS, SBS, SSB) • Logika XOR (BBS, BSB, SBB, SSS) • Logika N-XOR (BBB, BSS, SBS, SSB)

  3. Perulangan (For) • Syntax: for(kondisi1;kondisi2;kondisi3){ statement; } Ket: • kondisi1 = awalpengulangan; kondisi2 = maju/mundur, kondisi3 = akhirpengulangan • Penempatankondisibisaterbalik

  4. Contoh 1 #include<iostream> #include<conio.h> int main(){ int i; for (i=1;i<=10;i++){ cout << “Saya Dian, IniPengulanganNamaSaya yang Ke-”<< i <<“\n”; } getch(); }

  5. Contoh 2 #include<iostream> #include<conio.h> int main(){ int i; for (i=10;i>=1;i--){ cout << “BerhitungMundurMulai…”<< i <<“\n”; } getch(); }

  6. Contoh 3 #include<iostream> #include<conio.h> int main(){ int i; for (i=1;i<=10;i+=2){ cout << i-2 <<"+2 ="<< i <<"\n"; } getch(); }

  7. Rata-Rata Nilai #include<iostream> #include<conio.h> int main(){ float i,n,jum,a,rata; cout << "Berapa Banyak Jumlah Nilai yang Diinput? --> "; cin >> n; jum=0; for (i=1;i<=n;i++){ cout << "\nNilai Ke-" <<i << " = "; cin >> a; jum=jum+a; } rata=jum/n; cout << jum << ", " << rata; getch(); }

  8. Latihan For Ganjil • Munculkanangka-angkaganjildarirentang 0-1000! • Munculkanbentuk: * ** *** **** ***** • PadaTugas 2 No. 2, buatpembeliandanperhitungannyamenggunakanpengulangan! • SIMPLE BANK • AndamemilikisaldoawalRp 20.000,00; • Andadapatambildansetoruanganda, dengan minimal saldo di Bank Rp 10.000,00; • Buatlahprogramnyadengantampilan: Saldo : Rp 20.000; MENU • AmbilUang • SetorUang • Keluar

  9. Latihan For Genap • Munculkanangka-angkagenapdarirentang 0-1000! • Munculkanbentuk: ***** **** *** ** * • PadaTugas 2 No. 2, buatpembeliandanperhitungannyamenggunakanpengulangan! • SIMPLE BANK • AndamemilikisaldoawalRp 20.000,00; • Andadapatambildansetoruanganda, dengan minimal saldo di Bank Rp 10.000,00; • Buatlahprogramnyadengantampilan: Saldo : Rp 20.000; MENU • AmbilUang • SetorUang • Keluar

More Related