Loops in c

1,010 views

Published on

Loops in c

Published in: Technology, Travel
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,010
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
67
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Loops in c

  1. 1. Loops In C Program Typing Speed: 24 Ismail Ismailpk456@gmail.com Ismail Ismu Ismail Ismu in.linkedin.com/in/profilena me 8086303494
  2. 2. Loop  There may be a situation, when you need to execute a block of code several number of times. In general, statements are executed sequentially: The first statement in a function is executed first, followed by the second, and so on.  Programming languages provide various control structures that allow for more complicated execution paths.  A loop statement allows us to execute a statement or group of statements multiple times and following is the general form of a loop statement in most of the programming languages
  3. 3. Loops In C Entry control loop  for loop  while loop Exit control loop  do while loop
  4. 4. for loop • The traditional for loop found in C requires 3 parts: 1) Initialization 2) Condition 3) Increment
  5. 5. While loop • A while loop statement in C programming language repeatedly executes a target statement as long as a given condition is true.
  6. 6. Do while loop • which test the loop condition at the top of the loop, the do...while loop in C programming language checks its condition at the bottom of the loop. • A do...while loop is similar to a while loop, except that a do...while loop is guaranteed to execute at least one time
  7. 7. For loop Syntax for ( variable initialization; condition; variable update ) { Code to execute while the condition is true } Example for (j=0;j<5 ;j++) { printf(“Hai”); }
  8. 8. While loop Syntax while (expression) { // execute statements } Example int i = 10; while ( i > 0 ) { printf("Hello %dn", i ); i = i -1; }
  9. 9. do While loop Syntax do { statement(s); } while( condition ); Example int a = 1; Do { printf("value of a: %dn", a); a = a + 1; } while( a <= 10 );
  10. 10. If this presentation helped you, please visit our page facebook.com/baabtra and like it. Thanks in advance. www.baabtra.com | www.massbaab.com |www.baabte.com
  11. 11. Contact Us Emarald Mall (Big Bazar Building) Mavoor Road, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550 Start up Village Eranakulam, Kerala, India. Email: info@baabtra.com NC Complex, Near Bus Stand Mukkam, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550
  12. 12. THE END

×