• Like
Loops in c
Upcoming SlideShare
Loading in...5
×
Uploaded on

Loops in c

Loops in c

More in: Technology , Travel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
271
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
31
Comments
0
Likes
0

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. Loops In C Program Typing Speed: 24 Ismail Ismailpk456@gmail.com Ismail Ismu Ismail Ismu in.linkedin.com/in/profilena me 8086303494
  • 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. Loops In C Entry control loop  for loop  while loop Exit control loop  do while loop
  • 4. for loop • The traditional for loop found in C requires 3 parts: 1) Initialization 2) Condition 3) Increment
  • 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. 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. 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. While loop Syntax while (expression) { // execute statements } Example int i = 10; while ( i > 0 ) { printf("Hello %dn", i ); i = i -1; }
  • 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. 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. 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. THE END