The for statement The C++ for statement has the following form: Syntax: for (expression1;Condition;expression2) statement; for (expression1;Condition;expression2) { block of statements } expression1 initialises; expression2 is the terminate test; expression3 is the modifier (which may be more than just simple increment); NOTE: C/C++ basically treats for statements as while type loops For loop example program: /* Example Program For for Loop In C++ Programming Language */ // Header Files #include<iostream> using namespace std; //Main Function int main() { // Variable Declaration int x=3; //for loop for (x=3;x>0;x--) { cout<<"x="<<x<<endl; } //Main Function return Statement return 0; } Output: x=3 x=2 x=1 ...
"Learn To Believe Your Inner And Outer Confidence And If You Believe Then You Can Be Winner Of The World"