Sebuah algoritma dapat dibangun dari tiga buah struktur dasar yaitu
FerdiNp
Struktur Dasar Algoritma terdiri dari 3 macam, yaitu struktur sekuensial, struktur pemilihan dan struktur perulangan.
1. Struktur Sekuensial (runtutan)
Runtunan merupakan struktur dasar algoritma terdiri dari satu atau lebih instruksi, yang setiap instruksinya dikerjakan secara berurutan sesuai dengan urutan penulisan algoritma tersebut. Sebuah instruksi dikerjakan setelah instruksi sebelumnya dikerjakan.
2. Struktur Pemilihan (selection) Sruksur seleksi menyatakan pemilihan langkah yang didasarkan oleh suatu kondisi atau pengambilan suatu keputusan. Struktur ini ditandai selalu dengan bentuk flowcart decision (flowcart yang berbentuk belah ketupat). Bentuk Instruksi pemilihan : Instruksi IFInstruksi ini lebih cocok digunakan untuk pengambilan keputusan berdasarkan perbandingan nilai dengan operator <, <=, >, >= maupun operator = =,!=. Bentuk-bentuk unstruksi IF : Pernyataan IF SederhanaPernyataan IF-ELSEPernyataan IF BertingkatInstruksi SWITCHInstruksi ini lebih cocok dipakai untuk pengambilan keputusan berdasarkan perbandingan nilai = =.
3. Struktur Perulangan
Struktur ini memberikan suatu perintah atau tindakkan yang dilakukan beberapa kali. Misalnya jika teman mau menuliskan kata “Belajar C” sebanyak sepuluh kali. akan lebih efisien jika teman menggunakan sturktur ini dari pada sekedar menuliskannya berturut-turut sebanyak sepuluh kali.
1. Struktur Sekuensial (runtutan)
Runtunan merupakan struktur dasar algoritma terdiri dari satu atau lebih instruksi, yang setiap instruksinya dikerjakan secara berurutan sesuai dengan urutan penulisan algoritma tersebut. Sebuah instruksi dikerjakan setelah instruksi sebelumnya dikerjakan.
2. Struktur Pemilihan (selection)
Sruksur seleksi menyatakan pemilihan langkah yang didasarkan oleh suatu kondisi atau pengambilan suatu keputusan. Struktur ini ditandai selalu dengan bentuk flowcart decision (flowcart yang berbentuk belah ketupat).
Bentuk Instruksi pemilihan :
Instruksi IFInstruksi ini lebih cocok digunakan untuk pengambilan keputusan berdasarkan perbandingan nilai dengan operator <, <=, >, >= maupun operator = =,!=.
Bentuk-bentuk unstruksi IF :
Pernyataan IF SederhanaPernyataan IF-ELSEPernyataan IF BertingkatInstruksi SWITCHInstruksi ini lebih cocok dipakai untuk pengambilan keputusan berdasarkan perbandingan nilai = =.
3. Struktur Perulangan
Struktur ini memberikan suatu perintah atau tindakkan yang dilakukan beberapa kali. Misalnya jika teman mau menuliskan kata “Belajar C” sebanyak sepuluh kali. akan lebih efisien jika teman menggunakan sturktur ini dari pada sekedar menuliskannya berturut-turut sebanyak sepuluh kali.