For loop in C++

Source code :

#include<iostream>

using namespace std;

int main(){
int i;
for (i=0;i<10;i++)
{
    cout<<"The numbers are:"<<i;
}
return 0;

}

Output :

The numbers are:0123456789

Algorithm :

  1. Initialize the variable
  2. Use for loop syntax to print the numbers
  3. Print the result finally

Output :


                

Comments :