Algoritma dan Pemrograman Subrutin Tim Algoritma dan Pemrograman
![Algoritma dan Pemrograman Subrutin Tim Algoritma dan Pemrograman Universitas Komputer Indonesia Algoritma dan Pemrograman Subrutin Tim Algoritma dan Pemrograman Universitas Komputer Indonesia](https://slidetodoc.com/presentation_image_h/26ff7e759e28be5214dfa3e25e6c1d81/image-1.jpg)
Algoritma dan Pemrograman Subrutin Tim Algoritma dan Pemrograman Universitas Komputer Indonesia
![Jenis Subrutin 1. Prosedur 2. Fungsi Jenis Subrutin 1. Prosedur 2. Fungsi](http://slidetodoc.com/presentation_image_h/26ff7e759e28be5214dfa3e25e6c1d81/image-2.jpg)
Jenis Subrutin 1. Prosedur 2. Fungsi
![Prosedur Bentuk Umum: Parameter Formal Procedure nama_prosedur(<daftar parameter>) {I. S. : ……………………. . . Prosedur Bentuk Umum: Parameter Formal Procedure nama_prosedur(<daftar parameter>) {I. S. : ……………………. . .](http://slidetodoc.com/presentation_image_h/26ff7e759e28be5214dfa3e25e6c1d81/image-3.jpg)
Prosedur Bentuk Umum: Parameter Formal Procedure nama_prosedur(<daftar parameter>) {I. S. : ……………………. . . } {F. S. : ……………………. . …} Kamus: {kamus lokal} {deklarasi variabel dan tipedatanya} Algoritma: {aksi-aksi yg terjadi pada prosedur ini} End. Procedure
![Parameter Formal By value (Input) By reference {sebagai masukan utk subrutin} (Output, Input/Output) {sebagai Parameter Formal By value (Input) By reference {sebagai masukan utk subrutin} (Output, Input/Output) {sebagai](http://slidetodoc.com/presentation_image_h/26ff7e759e28be5214dfa3e25e6c1d81/image-4.jpg)
Parameter Formal By value (Input) By reference {sebagai masukan utk subrutin} (Output, Input/Output) {sebagai keluaran, atau sebagai masukkan dan kemudian dikeluarkan oleh subrutin}
![Contoh Parameter by Value Procedure Tampil_Faktorial (Input faktorial : real) {I. S. : harga Contoh Parameter by Value Procedure Tampil_Faktorial (Input faktorial : real) {I. S. : harga](http://slidetodoc.com/presentation_image_h/26ff7e759e28be5214dfa3e25e6c1d81/image-5.jpg)
Contoh Parameter by Value Procedure Tampil_Faktorial (Input faktorial : real) {I. S. : harga faktorial sudah terdefinisi} {F. S. : menampilkan faktorial} Kamus: Parameter Formal Algoritma: output (faktorial) End. Procedure Parameter by value
![Contoh Parameter by Reference Parameter Formal Procedure Isi_N (Output N : integer) {I. S. Contoh Parameter by Reference Parameter Formal Procedure Isi_N (Output N : integer) {I. S.](http://slidetodoc.com/presentation_image_h/26ff7e759e28be5214dfa3e25e6c1d81/image-6.jpg)
Contoh Parameter by Reference Parameter Formal Procedure Isi_N (Output N : integer) {I. S. : user memasukkan harga N} {F. S. : menghasilkan harga N} Kamus: Algoritma: input (N) End. Procedure Parameter by Reference
![Contoh Prosedur Procedure Faktorial (Input N : integer, Output Fak : real) {I. S. Contoh Prosedur Procedure Faktorial (Input N : integer, Output Fak : real) {I. S.](http://slidetodoc.com/presentation_image_h/26ff7e759e28be5214dfa3e25e6c1d81/image-7.jpg)
Contoh Prosedur Procedure Faktorial (Input N : integer, Output Fak : real) {I. S. : harga N sudah terdefinisi} {F. S. : menghasilkan harga Faktorial dari N} Kamus: i : integer {pencacah} Algoritma: if (N = 0) or (N = 1) Parameter by then Value Fak 1 else Fak 1 for i 2 to N do Fak * i endfor endif End. Procedure Parameter by Reference Parameter Formal
![Pemanggilan Prosedur nama_prosedur(parameter aktual) Contoh : Tampil_Faktorial(Faktorial) Nama Prosedur Parameter Aktual Pemanggilan Prosedur nama_prosedur(parameter aktual) Contoh : Tampil_Faktorial(Faktorial) Nama Prosedur Parameter Aktual](http://slidetodoc.com/presentation_image_h/26ff7e759e28be5214dfa3e25e6c1d81/image-8.jpg)
Pemanggilan Prosedur nama_prosedur(parameter aktual) Contoh : Tampil_Faktorial(Faktorial) Nama Prosedur Parameter Aktual
![Contoh Memanggil Prosedur {Algoritma Utama} Menghitung_Faktorial {I. S. : user memasukkan harga n} {F. Contoh Memanggil Prosedur {Algoritma Utama} Menghitung_Faktorial {I. S. : user memasukkan harga n} {F.](http://slidetodoc.com/presentation_image_h/26ff7e759e28be5214dfa3e25e6c1d81/image-9.jpg)
Contoh Memanggil Prosedur {Algoritma Utama} Menghitung_Faktorial {I. S. : user memasukkan harga n} {F. S. : menampilkan harga Faktorial dari N} Kamus: N : integer {harga yg akan difaktorialkan} Fak : real Procedure Isi_N(Output N : integer) Procedure Faktorial(Input N : integer, Output Fak : real) Procedure Tampil_Faktorial(Input Faktorial : real) Algoritma: Parameter Aktual Isi_N(N) Faktorial(N, Fak) Tampil_Faktorial(Fak)
![SELESAI Alhamdulillah SELESAI Alhamdulillah](http://slidetodoc.com/presentation_image_h/26ff7e759e28be5214dfa3e25e6c1d81/image-10.jpg)
SELESAI Alhamdulillah
- Slides: 10