FOR LOOP IN C++

SAIROSHNI

 
For loop in c++

For Loop

Use the for loop rather than the while loop when you know exactly how many times you want to cycle through a section of code.

Program:

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

Output:

1
2
3
4
5
6
7
8
9

Tags
Our website uses cookies to enhance your experience. Learn More
Accept !

GocourseAI

close
send