For Loop

When you know how many times you want to repeat a block of code, you use the for loop. It consists of three parts: initialization, condition, and iteration.

   Syntax:-

for (initialization; condition; iteration) {
    // Code write here
}

Example:-

#include <iostream>

int main(){
int a=0;
std::cout<<"print the 1 to enter the mix value";
std::cin>>a;
for (int i = 1; i<= a; i++) {
    std::cout << i << " ";
}
return 0;
}