how to make loop in c++

C++
//Basic for loop
	int n = 30;
	for(int i = 0; i <n; i++){
	//runs code for 30 times
  	cout << i << " ";
      
	}


for (int i = 0; i < 5; i++) {
  cout << i << "\n";
}
Source

Also in C++: