loops in c

34
WHILE DO..WHILE FOR EXITING FROM A LOOP (BREAK,CONTINUE, GOTO) Loops

Upload: kamal-acharya

Post on 06-May-2015

1.877 views

Category:

Education


4 download

DESCRIPTION

This slide give the introduction to the various loops available in C Programming. Which include while loop, do while loop and for loop.

TRANSCRIPT

Page 1: Loops in C

WHILEDO..WHILEFOREXITING FROM A LOOP (BREAK,CONTINUE, GOTO)

Loops

Page 2: Loops in C

While

Page 3: Loops in C

While

Page 4: Loops in C

While

Page 5: Loops in C

While

Page 6: Loops in C

Do…While

Page 7: Loops in C

D0…While

Page 8: Loops in C

Do…While

Page 9: Loops in C

Do…While

Page 10: Loops in C

For Loop

Page 11: Loops in C

For Loop

Page 12: Loops in C

For Loop

Page 13: Loops in C

For Loop

Page 14: Loops in C

For Loop

Page 15: Loops in C

For Loop

Page 16: Loops in C

For Loop

Page 17: Loops in C

Break Statement

It is an jump instruction and can be used inside the switch and loop statements.

The execution of the break statements causes the control transfer to the statement immediately after the loop.

Page 18: Loops in C

Break Statement

Page 19: Loops in C

Break Statement

Page 20: Loops in C

Break Statement

Page 21: Loops in C

Break Statement

Page 22: Loops in C

Break Statement

Page 23: Loops in C

Break Statement

Page 24: Loops in C

Continue Statement

It is a jump statement.It is used only inside the loop.Its execution does not exit from the loop but

escape the loop for that iteration and transfer the control back to the loop for the new iteration.

Page 25: Loops in C

Continue Statement

Page 26: Loops in C

Continue Statement

Page 27: Loops in C

Continue Statement

Page 28: Loops in C

Continue Statement

Page 29: Loops in C

Continue Statement

Page 30: Loops in C

Goto Statement

It is used the alter the normal sequence of flow by transferring the control to some other part of the program unconditionally.

It is followed by the label statement which determine the instruction to be handled next after the execution of the goto statement.

Page 31: Loops in C

Goto Statement

Page 32: Loops in C

Goto Statement

Page 33: Loops in C

Goto Statement

Page 34: Loops in C

Goto Statement