Your SlideShare is downloading. ×
  • Like
06 nested
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Now you can save presentations on your phone or tablet

Available for both IPhone and Android

Text the download link to your phone

Standard text messaging rates apply

06 nested

  • 54 views
Published

 

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
54
On SlideShare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
1
Comments
0
Likes
1

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 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