Wednesday, July 5, 2017

for loop in C++

C++ program to print 1 to 10 numbers using for loop.

#include<iostream>
using namespace std;
int main()
{
  int i;
  for(i=1; i<=10; i++)
  {
    cout << i << " ";
  }
  return 0;
}

Output of the program

1 2 3 4 5 6 7 8 9 10

No comments:

Post a Comment