c for each
Sure! Here is an example of using a for loop in C:
#include <stdio.h>
int main() {
int i;
for(i = 0; i < 10; i++) {
printf("%d\n", i);
}
return 0;
}
In this example, we have a for loop that runs 10 times. The loop variable i
is initialized to 0, and the loop continues as long as i
is less than 10. After each iteration, the value of i
is incremented by 1. In each iteration, the loop prints the value of i
using the printf
function. Finally, the program returns 0, indicating successful execution.