for loop example

Example 1: how to make a Loop in c++

for (int i; i < 10; i++)
{
  cout << i << "\n";
}

Example 2: Java for loop

int values[] = {1,2,3,4};
for(int i = 0; i < values.length; i++)
{
 	System.out.println(values[i]); 
}

Example 3: for loop c

for(int i = 0; i<n ;i++) //i is the number of iterations that occur
{						 //n is the total number of iterations
 //code here
}

Example 4: for loop in c

int i;
for (i = 0; i < n; ++i) { // n is the number of iterations
	// Code here
}

Example 5: for loop

for (let i = 0; i < array.length; i++) {

}

Example 6: for loop

for(int i = 0; i < some_number; i++){
  	//inside loop do whatever you want
}

Tags:

C Example