for (Expression 1; Expression 2; Expression 3) { // Code to execute}
Example of For Loop in C
👇 Click to get👇
👉 Collection of C Language Knowledge Materials
#include <stdio.h>
int main() { int i; for (i = 1; i <= 10; i++) { printf("%d \n", i); }
return 0;}
12345678910
#include <stdio.h>
int main() { int i, number; printf("Enter a number: "); scanf("%d", &number);
for (i = 1; i <= 10; i++) { printf("%d \n", (number * i)); }
return 0;}
Enter a number: 22468101214161820
Loop Body
#include <stdio.h>
int main() { int i; for (i = 0; i < 10; i++) { int i = 20; printf("%d ", i); }
return 0;}
20 20 20 20 20 20 20 20 20 20
Infinite For Loop
#include <stdio.h>
int main() { for (;;) { printf("Welcome to javatpoint"); }}
Programmer Technical Exchange Group
Scan the code to join the group, remember to note: city, nickname, and technical direction.