1 / 27

Konsep Pemrograman 3

Konsep Pemrograman 3. sbw@javagroup.co.id. Flowchart. Mencetak perkalian dua dan perkalian empat sebuah bilangan. Flowchart. Menampilkan sebuah kalimat yang dimasukkan kedalam sistem berulang kali sesuai dengan keinginan. Flowchart. Mencari akar bulat positif dari bilangan

arama
Download Presentation

Konsep Pemrograman 3

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. Konsep Pemrograman3 sbw@javagroup.co.id

  2. Flowchart Mencetak perkalian dua dan perkalian empat sebuah bilangan

  3. Flowchart Menampilkan sebuah kalimat yang dimasukkan kedalam sistem berulang kali sesuai dengan keinginan.

  4. Flowchart Mencari akar bulat positif dari bilangan bulat (integer) positif a: • Masukkan bilangan bulat positif a • Berikan harga awal x sama dengan 1 • Hitung y sebesar x * x • Jika y sama dengan a maka cetak x sebagai akar dari a. Selesai • Tambah nilai x dengan 1 • Pergi ke langkah 3.

  5. Flowchart Menentukan apakah suatu bilangan merupakan bilangan ganjil atau bilangan genap. • Masukkan sebuah bilangan sembarang • Bagi bilangan tersebut dengan bilangan 2 • Hitung sisa hasil bagi pada langkah 2. • Bila sisa hasil bagi sama dengan 0 maka bilangan itu adalah bilangan genap tetapi bila sisa hasil bagi sama dengan 1 maka bilangan itu adalah bilangan ganjil.

  6. Flowchart Penilaian ujian adalah sebagai berikut: • A >= 90 • 80 >= B > 90 • 60 >= C > 80 • 40 >= D > 60 • E < 40

  7. Hitunglah semua bilangan genap antara 1 hingga 10.

  8. NOTASI ALGORITMA (FLOWCHART) Start A Langkah ke-1: Proses A B Langkah ke-2: Proses B SEQUENCE RUNUT C Langkah ke-3: Proses C D Langkah ke-4: Proses D Stop Pendahuluan

  9. NOTASI ALGORITMA (FLOWCHART) Start SELECTION PEMILIHAN A Ya B ATAU Ke-1: Proses A Ke-2: Proses B Ke-3: Proses D C Ke-1: Proses A Ke-2: Proses B Ke-3: Proses C Ke-4: Proses D D Stop Pendahuluan

  10. NOTASI ALGORITMA (FLOWCHART) Start SELECTION PEMILIHAN A Ya B C D Ke-1: Proses A Ke-2: Proses B Ke-3: Proses D Ke-4: Proses E Ke-1: Proses A Ke-2: Proses B Ke-3: Proses C Ke-4: Proses E E Stop Pendahuluan

  11. NOTASI ALGORITMA (FLOWCHART) Start ITERATION PENGULANGAN A Ke-1: Proses A Ke-2: Proses B Ke-3: Proses C Ke-4: Proses B Ke-5: Proses C … Ke-n-1: Proses B Ke-n: Proses D C B Ya D Stop Pendahuluan

  12. NOTASI ALGORITMA (PSEUDOCODE) input, read, get, key-in Masukan Keluaran print, write, display  Pemberian nilai if <kondisi benar> <proses> else <proses> endif Pemilihan if <kondisi benar> <proses> endif Pendahuluan

  13. NOTASI ALGORITMA (PSEUDOCODE) for <kondisi benar> <proses> endfor PENGULANGAN while <kondisi benar> <proses> endwhile do <kondisi benar> <proses> while <kondisi benar> repeat <proses> until <kondisi benar> Pendahuluan

  14. POTONGAN HARGA SUSU Toko Indo April memberi potongan harga susu 20%, maksimum 3 kaleng atau kotak. Berapa uang yang harus dibayar pembeli? Masukan ? Keluaran ? Jumlah yang dibeli Harga sekaleng Uang yang harus dibayar Jumlah, Harga Algoritma Bayar Flowchart Pseudodcode Pendahuluan

  15. POTONGAN HARGA SUSU Potongan 20%, maksimum 3. A Start Read HRG, JML Print BYR Stop Ya JML  3 BYR= 3*HRG*0.8 + (JML-3)*HRG BYR= JML*HRG*0.8 A Pendahuluan

  16. POTONGAN HARGA SUSU Potongan 20%, maksimum 3. PSEUDOCODE input harga, jumlah if jumlah <= 3 bayar  jumlah * harga * 0.8 else bayar  (3 * harga * 0.8) + (jumlah – 3) * harga endif printbayar Pendahuluan

  17. MENGECAT DINDING Toko Indo April mau mengecat dinding kedua sisi, 12m2 perlu sekaleng cat. Berapa kaleng cat diperlukan? Masukan ? Keluaran ? Panjang dinding Tinggi dinding Jumlah kaleng cat Pj1, Tg1, Pj2, Tg2 Algoritma Kaleng Flowchart Pseudodcode Pendahuluan

  18. Intro to C

  19. In the computer world, the further a programming language is from the computer architecture, the higher the language's level. You can imagine that the lowest-level languages are machine languages that computers understand directly. The high-level programming languages, on the other hand, are closer to our human languages.

  20. Bahasa Tingkat Tinggi • Ada • Modula-2 • Pascal • Cobol • Fortran • Basic

  21. Bahasa Tingkat Menengah • Java • C++ • C • Forth Bahasa Tingkat Rendah • Macro Assembler • Assembler

  22. Bahasa C adalah merupakan bahasa pemrograman tingkat menengah yaitu diantara bahasa tinggat rendah dan tingkat tinggi yang biasa disebut dengan Bahasa Tingkat Tinggi dengan Perintah Assembly

  23. SEJARAH BAHASA C • Bahasa C dirancang oleh Dennis Mc Allistair Ritchie, AT&T Bell laboratories, 1972 • Dirancang untuk mengembangkan piranti lunak sistem • Kernel sistem operasi UNIX ditulis kembali dengan bahasa C, 1973 • Publikasi melalui buku The C Programming Language, Brian W. Kernighan dan Dennis M. Ritchie, 1978 Operator

  24. C have the following advantages: • Readability: Programs are easy to read. • Maintainability: Programs are easy to maintain. • Portability: Programs are easy to port across different computer platforms.

  25. Each high-level language needs a compiler or an interpreter to translate instructions written in the high-level programming language into a machine language that a computer can understand and execute. Different machines may need different compilers or interpreters for the same programming language.

  26. A CPU has millions of transistors that make use of electronic switches. The electronic switches have only two states: off and on. (Symbolically, 0 and 1 are used to represent the two states.) Therefore, a computer can only understand instructions consisting of series of 0s and 1s. In other words, machine-readable instructions have to be in binary format.

  27. However, a computer program written in a high-level language, such as C, Java, or Perl, is just a text file, consisting of English-like characters and words. We have to use some special programs, called compilers or interpreters, to translate such a program into a machine-readable code. That is, the text format of all instructions written in a high-level language has to be converted into the binary format. The code obtained after the translation is called binary code. Prior to the translation, a program in text format is called source code.

More Related