|
CS256 - Principles of Structured Design
Fall 2021
|
Displaying ./code/cs256su21code/jun02/countFor.c
/*
this is like the count.c program in the jun01 directory, but
this uses a for loop instead of a while loop.
*/
#include <stdio.h>
int main()
{
int i; //declaring an integer "i"
/*
below the for loop consists of three arguments
from left-to-right, seperated by semicolons, we have
left: the initial statement: where we're starting
middle: the compairsion statement: as long as this is true, do this
right: increment statement: updates the variable, and we do this again.
*/
for(i = 1; i <= 10; i++){
printf("%d\n", i);
}
return 0;
}
|