You are on page 1of 1

/*for loop

Syntax of for loop


initialization -> i = 0;
condition -> i < 10
increment/decrement -> i++, x++ (i=i+1), i--, x-- (i=i-1)
(1) (2) (4)
for(initialization; condition ; increment/decrement)
{
C++ statement(s); (3)
}
*/
//1 - 10
#include <iostream>
using namespace std;

int main()
{
int i; //loop
// (1) (2) (4)
for( i=1 ; i<=10 ; i=i+1 ) // i++
{
cout << i << ' '; // (3)
}

return 0;
}

You might also like