/* * forloop1.c */ #include int main(void) { int counter; // declare counter int sum = 0; // declare and initialize sum printf("%7s\t%3s\n", "counter", "sum"); // print right justified headers for( counter=0; counter <=10; counter=(counter+1) )// initialize counter to 0 first round // evaluate if counter <=10 // if true, run inside of loop // increment counter by 1 { sum=(sum+counter); // update the sum, by adding counter to sum. printf("%4d\t%3d\n", counter, sum); // print right justified counter and sum } return 0; }