1// Print numbers from 1 to 10
2#include <stdio.h>
3
4int main() {
5 int i;
6
7 for (i = 1; i < 11; ++i)
8 {
9 printf("%d ", i);
10 }
11 return 0;
12}
1for(int i = 0; i<n ;i++) //i is the number of iterations that occur
2{ //n is the total number of iterations
3 //code here
4}
1int i;
2for (i = 0; i < n; ++i) { // n is the number of iterations
3 // Code here
4}
1//Sample for loop in c
2//Prints the contents of the array in new lines
3#include <stdio.h>
4int main(){
5 int a, b[5] = {2, 4, 5, 7, 9};
6 for (a = 0; a<5; a++){
7 printf("%d\n", b[a]);
8 }
9
10
11}