C examples for Statement:for
The general pattern for the for loop is:
for(starting_condition; continuation_condition ; action_per_iteration)
loop_statement;
next_statement;
To display the numbers from 1 to 10.
#include <stdio.h> int main(void){ int count = 1;//from w w w. j a v a2s. c o m for( ; count <= 10 ; ++count){ printf(" %d", count); } printf("\nAfter the loop count has the value %d.\n", count); return 0; }