SlideShare a Scribd company logo
1 of 2
Download to read offline
STRUKTUR KENDALI
PROSES
Infinite Loop
Infinite loop adalah pengulangan tanpa akhir.
Jika kondisi selalu bernilai true (bukan 0),
maka akan terus menerus dilakukan.
for( ; ; ) { statement }
for( ; 1 ; ) { statement }
do { statement } while (1);
while(1) { statement }
Statement akan terus menerus dikerjakan,
untuk keluar dari infinite loop kita pergunakan
instruksi break
Infinite Loop
contoh :
#include <stdio.h>
#include <stdlib.h>
int main() {
int i=0;
while(1) {
printf(“%-3d”,i++);
if(i >= 10) break;
}
system(“PAUSE”);
return 0;
}
contoh :
#include <stdio.h>
#include <stdlib.h>
int main() {
int i=0;
for( ; ; ) {
printf(“%-3d”,i++);
if(i >= 10) break;
}
system(“PAUSE”);
return 0;
}
Nested if
Nested if adalah instruksi if atau if else yang
statementnya merupakan if atau if else lain.
If(kondisi_1)
if(konsisi_2)
If(kondisi_3)
statement_1;
else
statement_2;
Kondisi_1
Kondisi_2
Kondisi_3
Statement_1Statement_2
true
true
truefalse
Netsed if
Nested if adalah instruksi if atau if else yang
statementnya merupakan if atau if else lain.
if(kondisi_1) statement_1;
else if(kondisi_2) statement_2;
else if(kondisi_3) statement_3;
else statement_4;
Kondisi_1
Kondisi_2 Statement_1
Statement_2Kondisi_3
Statement_3Statement_4
true
true
true
false
false
false
Nested for
for(i= 0; i < 3; i ++)
for (j= 0; j < 2; j++)
printf(“i = %2d, j = %2d”,i,j);
j++
i++, j = 0
j++
i++, j = 0
j++
awal
i=0;j=0
keterangan
12
02
11
01
10
00
ji
END

More Related Content

Viewers also liked

Viewers also liked (9)

02 01-elemen
02 01-elemen02 01-elemen
02 01-elemen
 
Introductory maths analysis chapter 17 official
Introductory maths analysis   chapter 17 officialIntroductory maths analysis   chapter 17 official
Introductory maths analysis chapter 17 official
 
Introductory maths analysis chapter 11 official
Introductory maths analysis   chapter 11 officialIntroductory maths analysis   chapter 11 official
Introductory maths analysis chapter 11 official
 
Introductory maths analysis chapter 09 official
Introductory maths analysis   chapter 09 officialIntroductory maths analysis   chapter 09 official
Introductory maths analysis chapter 09 official
 
Introductory maths analysis chapter 10 official
Introductory maths analysis   chapter 10 officialIntroductory maths analysis   chapter 10 official
Introductory maths analysis chapter 10 official
 
Introductory maths analysis chapter 15 official
Introductory maths analysis   chapter 15 officialIntroductory maths analysis   chapter 15 official
Introductory maths analysis chapter 15 official
 
Introductory maths analysis chapter 04 official
Introductory maths analysis   chapter 04 officialIntroductory maths analysis   chapter 04 official
Introductory maths analysis chapter 04 official
 
03 i-o
03 i-o03 i-o
03 i-o
 
Introductory maths analysis chapter 01 official
Introductory maths analysis   chapter 01 officialIntroductory maths analysis   chapter 01 official
Introductory maths analysis chapter 01 official
 

Similar to Struktur Kendali Proses Infinite Loop dan Nested

Algoritma&Pemrograman C++ Pertemuan 1
Algoritma&Pemrograman C++ Pertemuan 1Algoritma&Pemrograman C++ Pertemuan 1
Algoritma&Pemrograman C++ Pertemuan 1Menny SN
 
Java (Netbeans) - Looping - Object Oriented Programming
Java (Netbeans) - Looping - Object Oriented ProgrammingJava (Netbeans) - Looping - Object Oriented Programming
Java (Netbeans) - Looping - Object Oriented ProgrammingMelina Krisnawati
 
Pengulanganwhilealgoritma
PengulanganwhilealgoritmaPengulanganwhilealgoritma
Pengulanganwhilealgoritmacasnadi
 
5. struktur kontrol alur program lanjutan
5. struktur kontrol alur program lanjutan5. struktur kontrol alur program lanjutan
5. struktur kontrol alur program lanjutanAnna Fitria
 
PBO Pert 5 Praktek
PBO Pert 5 PraktekPBO Pert 5 Praktek
PBO Pert 5 PraktekRUDISELAMAT2
 
2_Struktur_kontrol.pdf
2_Struktur_kontrol.pdf2_Struktur_kontrol.pdf
2_Struktur_kontrol.pdfJurnal IT
 
2_Struktur_kontrol.pdf
2_Struktur_kontrol.pdf2_Struktur_kontrol.pdf
2_Struktur_kontrol.pdfJurnal IT
 
Pertemuan 6 : Algoritma & Pemrograman
Pertemuan 6 : Algoritma & PemrogramanPertemuan 6 : Algoritma & Pemrograman
Pertemuan 6 : Algoritma & PemrogramanTri Retna
 
Pertemuan 6B.pptx
Pertemuan 6B.pptxPertemuan 6B.pptx
Pertemuan 6B.pptxMenny SN
 
2. teknik pemilihan dalam_pemrograman
2. teknik pemilihan dalam_pemrograman2. teknik pemilihan dalam_pemrograman
2. teknik pemilihan dalam_pemrogramanRoziq Bahtiar
 
Pertemuan iv
Pertemuan ivPertemuan iv
Pertemuan ivwindi1
 
Penggunaan loop sebagai kerangka dasar algoritma
Penggunaan loop sebagai kerangka dasar algoritma Penggunaan loop sebagai kerangka dasar algoritma
Penggunaan loop sebagai kerangka dasar algoritma Fazar Ikhwan Guntara
 
Laporan5
Laporan5Laporan5
Laporan5Sa Lam
 
02.19 Java SE_else if statement
02.19 Java SE_else if statement02.19 Java SE_else if statement
02.19 Java SE_else if statementJefri Fahrian
 

Similar to Struktur Kendali Proses Infinite Loop dan Nested (20)

05 for-dowhile-while
05 for-dowhile-while05 for-dowhile-while
05 for-dowhile-while
 
Pt6 pt-loop komplek
Pt6 pt-loop komplekPt6 pt-loop komplek
Pt6 pt-loop komplek
 
Algoritma&Pemrograman C++ Pertemuan 1
Algoritma&Pemrograman C++ Pertemuan 1Algoritma&Pemrograman C++ Pertemuan 1
Algoritma&Pemrograman C++ Pertemuan 1
 
Java (Netbeans) - Looping - Object Oriented Programming
Java (Netbeans) - Looping - Object Oriented ProgrammingJava (Netbeans) - Looping - Object Oriented Programming
Java (Netbeans) - Looping - Object Oriented Programming
 
Pengulanganwhilealgoritma
PengulanganwhilealgoritmaPengulanganwhilealgoritma
Pengulanganwhilealgoritma
 
5. struktur kontrol alur program lanjutan
5. struktur kontrol alur program lanjutan5. struktur kontrol alur program lanjutan
5. struktur kontrol alur program lanjutan
 
PBO Pert 5 Praktek
PBO Pert 5 PraktekPBO Pert 5 Praktek
PBO Pert 5 Praktek
 
207 p05
207 p05207 p05
207 p05
 
2_Struktur_kontrol.pdf
2_Struktur_kontrol.pdf2_Struktur_kontrol.pdf
2_Struktur_kontrol.pdf
 
2_Struktur_kontrol.pdf
2_Struktur_kontrol.pdf2_Struktur_kontrol.pdf
2_Struktur_kontrol.pdf
 
Pertemuan 6 : Algoritma & Pemrograman
Pertemuan 6 : Algoritma & PemrogramanPertemuan 6 : Algoritma & Pemrograman
Pertemuan 6 : Algoritma & Pemrograman
 
Struktur Kontrol
Struktur KontrolStruktur Kontrol
Struktur Kontrol
 
Pertemuan 6B.pptx
Pertemuan 6B.pptxPertemuan 6B.pptx
Pertemuan 6B.pptx
 
Prokom raw
Prokom rawProkom raw
Prokom raw
 
2. teknik pemilihan dalam_pemrograman
2. teknik pemilihan dalam_pemrograman2. teknik pemilihan dalam_pemrograman
2. teknik pemilihan dalam_pemrograman
 
Pertemuan iv
Pertemuan ivPertemuan iv
Pertemuan iv
 
Penggunaan loop sebagai kerangka dasar algoritma
Penggunaan loop sebagai kerangka dasar algoritma Penggunaan loop sebagai kerangka dasar algoritma
Penggunaan loop sebagai kerangka dasar algoritma
 
Laporan5
Laporan5Laporan5
Laporan5
 
02.19 Java SE_else if statement
02.19 Java SE_else if statement02.19 Java SE_else if statement
02.19 Java SE_else if statement
 
Pertemuan iv
Pertemuan ivPertemuan iv
Pertemuan iv
 

More from Evert Sandye Taasiringan

Introductory maths analysis chapter 14 official
Introductory maths analysis   chapter 14 officialIntroductory maths analysis   chapter 14 official
Introductory maths analysis chapter 14 officialEvert Sandye Taasiringan
 
Introductory maths analysis chapter 16 official
Introductory maths analysis   chapter 16 officialIntroductory maths analysis   chapter 16 official
Introductory maths analysis chapter 16 officialEvert Sandye Taasiringan
 
Introductory maths analysis chapter 13 official
Introductory maths analysis   chapter 13 officialIntroductory maths analysis   chapter 13 official
Introductory maths analysis chapter 13 officialEvert Sandye Taasiringan
 
Introductory maths analysis chapter 12 official
Introductory maths analysis   chapter 12 officialIntroductory maths analysis   chapter 12 official
Introductory maths analysis chapter 12 officialEvert Sandye Taasiringan
 
Introductory maths analysis chapter 03 official
Introductory maths analysis   chapter 03 officialIntroductory maths analysis   chapter 03 official
Introductory maths analysis chapter 03 officialEvert Sandye Taasiringan
 
Introductory maths analysis chapter 05 official
Introductory maths analysis   chapter 05 officialIntroductory maths analysis   chapter 05 official
Introductory maths analysis chapter 05 officialEvert Sandye Taasiringan
 
Introductory maths analysis chapter 02 official
Introductory maths analysis   chapter 02 officialIntroductory maths analysis   chapter 02 official
Introductory maths analysis chapter 02 officialEvert Sandye Taasiringan
 
Introductory maths analysis chapter 06 official
Introductory maths analysis   chapter 06 officialIntroductory maths analysis   chapter 06 official
Introductory maths analysis chapter 06 officialEvert Sandye Taasiringan
 
Introductory maths analysis chapter 08 official
Introductory maths analysis   chapter 08 officialIntroductory maths analysis   chapter 08 official
Introductory maths analysis chapter 08 officialEvert Sandye Taasiringan
 
Introductory maths analysis chapter 00 official
Introductory maths analysis   chapter 00 officialIntroductory maths analysis   chapter 00 official
Introductory maths analysis chapter 00 officialEvert Sandye Taasiringan
 
Introductory maths analysis chapter 07 official
Introductory maths analysis   chapter 07 officialIntroductory maths analysis   chapter 07 official
Introductory maths analysis chapter 07 officialEvert Sandye Taasiringan
 

More from Evert Sandye Taasiringan (20)

07 function 2
07 function 207 function 2
07 function 2
 
04 if-ifelse-switch-break
04 if-ifelse-switch-break04 if-ifelse-switch-break
04 if-ifelse-switch-break
 
02 02-operasi
02 02-operasi02 02-operasi
02 02-operasi
 
01 pseudocode
01 pseudocode01 pseudocode
01 pseudocode
 
01 algoritma
01 algoritma01 algoritma
01 algoritma
 
01 02-pseudocode
01 02-pseudocode01 02-pseudocode
01 02-pseudocode
 
01 01-algoritma
01 01-algoritma01 01-algoritma
01 01-algoritma
 
Introductory maths analysis chapter 14 official
Introductory maths analysis   chapter 14 officialIntroductory maths analysis   chapter 14 official
Introductory maths analysis chapter 14 official
 
Introductory maths analysis chapter 16 official
Introductory maths analysis   chapter 16 officialIntroductory maths analysis   chapter 16 official
Introductory maths analysis chapter 16 official
 
Introductory maths analysis chapter 13 official
Introductory maths analysis   chapter 13 officialIntroductory maths analysis   chapter 13 official
Introductory maths analysis chapter 13 official
 
Introductory maths analysis chapter 12 official
Introductory maths analysis   chapter 12 officialIntroductory maths analysis   chapter 12 official
Introductory maths analysis chapter 12 official
 
Introductory maths analysis chapter 03 official
Introductory maths analysis   chapter 03 officialIntroductory maths analysis   chapter 03 official
Introductory maths analysis chapter 03 official
 
Introductory maths analysis chapter 05 official
Introductory maths analysis   chapter 05 officialIntroductory maths analysis   chapter 05 official
Introductory maths analysis chapter 05 official
 
Introductory maths analysis chapter 02 official
Introductory maths analysis   chapter 02 officialIntroductory maths analysis   chapter 02 official
Introductory maths analysis chapter 02 official
 
Introductory maths analysis chapter 06 official
Introductory maths analysis   chapter 06 officialIntroductory maths analysis   chapter 06 official
Introductory maths analysis chapter 06 official
 
Introductory maths analysis chapter 08 official
Introductory maths analysis   chapter 08 officialIntroductory maths analysis   chapter 08 official
Introductory maths analysis chapter 08 official
 
Introductory maths analysis chapter 00 official
Introductory maths analysis   chapter 00 officialIntroductory maths analysis   chapter 00 official
Introductory maths analysis chapter 00 official
 
Introductory maths analysis chapter 07 official
Introductory maths analysis   chapter 07 officialIntroductory maths analysis   chapter 07 official
Introductory maths analysis chapter 07 official
 
Pertemuan ke 1
Pertemuan ke 1Pertemuan ke 1
Pertemuan ke 1
 
Manajemen operasional ringkasan uas
Manajemen operasional ringkasan uas Manajemen operasional ringkasan uas
Manajemen operasional ringkasan uas
 

Struktur Kendali Proses Infinite Loop dan Nested

  • 1. STRUKTUR KENDALI PROSES Infinite Loop Infinite loop adalah pengulangan tanpa akhir. Jika kondisi selalu bernilai true (bukan 0), maka akan terus menerus dilakukan. for( ; ; ) { statement } for( ; 1 ; ) { statement } do { statement } while (1); while(1) { statement } Statement akan terus menerus dikerjakan, untuk keluar dari infinite loop kita pergunakan instruksi break Infinite Loop contoh : #include <stdio.h> #include <stdlib.h> int main() { int i=0; while(1) { printf(“%-3d”,i++); if(i >= 10) break; } system(“PAUSE”); return 0; } contoh : #include <stdio.h> #include <stdlib.h> int main() { int i=0; for( ; ; ) { printf(“%-3d”,i++); if(i >= 10) break; } system(“PAUSE”); return 0; } Nested if Nested if adalah instruksi if atau if else yang statementnya merupakan if atau if else lain. If(kondisi_1) if(konsisi_2) If(kondisi_3) statement_1; else statement_2; Kondisi_1 Kondisi_2 Kondisi_3 Statement_1Statement_2 true true truefalse
  • 2. Netsed if Nested if adalah instruksi if atau if else yang statementnya merupakan if atau if else lain. if(kondisi_1) statement_1; else if(kondisi_2) statement_2; else if(kondisi_3) statement_3; else statement_4; Kondisi_1 Kondisi_2 Statement_1 Statement_2Kondisi_3 Statement_3Statement_4 true true true false false false Nested for for(i= 0; i < 3; i ++) for (j= 0; j < 2; j++) printf(“i = %2d, j = %2d”,i,j); j++ i++, j = 0 j++ i++, j = 0 j++ awal i=0;j=0 keterangan 12 02 11 01 10 00 ji END