for (int i = 0; i < 5; i++) {
cout << i << " ";
}
// Output: 0 1 2 3 4
Three parts: init ; condition ; update
for (int i = 10; i >= 1; i--) {
cout << i << " ";
}
// 10 9 8 7 ... 1
for (int i = 1; i <= 3; i++)
for (int j = 1; j <= 3; j++)
cout << i * j << "\t";
Write power(int base, int exp) that returns base raised to exp using a for loop (no pow()).
Example: power(2, 10) → 1024
Click "Run" to execute your code.