Showing posts with label loop. Show all posts
Showing posts with label loop. Show all posts

C Language | For Loop Statement

Wednesday, 5 December 2012


After I showed you how the Do-While Loop executes, I will now show you the second looping statement which is more easier to use, the For Loop. For Loop repetition statement is a one line argument. It holds the control variable, condition and the increment of control variable in one line/argument, which makes it more easy. For Loop is used on most programs because it helps a lot in making a program short and straight.

Now, I made a sample program to show you how the for loop works. The sample I made is the same example I had in the do-while loop. I just changed it to for loop statement. In this example, you will observe the difference between the do-while and for loop statements and how the codes are arranged. Check out the codes below.

     1:  
   2:  #include <stdio.h>
   3:  #include <conio.h>
   4:   
   5:  int main()
   6:  {
   7:  int n;
   8:  int value = 1;
Related Posts Plugin for WordPress, Blogger...