In this example, the initial and final loop variable i (of type int) are 1 and 10, respectively. The increment expression, i += 1, increases the value of i by 1. Thus, i assume values 1, 2, 3, 4, and 5.
Note that the final expression, i <= 10, evaluates as false for the next value of 1, i. e., 11. The printf statement, which executes for each value of i, prints the value of i and i * i followed by a newline. The output is as shown below.
#include<stdio.h> #include<conio.h> void main() { int i; for(i = 1; i < 10; i++) printf("%8d %8d %8d\n", i, i * i, i * i * i); getch(); }