C Programing – Idea of Looping Statement – Part-1

0

C Programing

What is Loop?

Loop is a statement to be repeated. A loop is a program which consist of two segments,

a) Body of the Loop- Consist how the loop will run.

b) Control Statement- The control statement consists of certain conditions which are checked during execution and depending on the condition with in the body of Loop.

For Loop:

                   For (initialization;condition;increment)

                 {

                  body of loop

                   }

Now we will print 0-9 with for For loop………….

Example-1

#include <stdio.h>

#include<conio.h>
int main()
{
int x;

for ( x = 0; x < 10; x++ )   /* The loop goes while x < 10, and x increases by one every loop*/

{
/* Keep in mind that the loop condition checks
the conditional statement before it loops again.
consequently, when x equals 10 the loop breaks.
x is updated before the condition is checked. */
printf( “%d\n”, x );
}
getch();
}

Output:0 to 9

                                          ——————– Thanks Everyone

Share.

About Author

Chakraborty Prijus

Former Asst. Manager (IT) - MGH Group MCA (Masters in Computer Application) From Sikkim Manipal University India. Have 5 years experience In IT field.

Leave A Reply

Powered by themekiller.com