Printing integers from 1 to 10 using for loop C program example
Compiler: Visual C++ Express Edition 2005
Compiled on Platform: Windows XP Pro SP2
Header file: Standard
Additional library: none/default
Additional project setting: Set project to be compiled as C
Project -> your_project_name Properties -> Configuration Properties -> C/C++ -> Advanced -> Compiled As: Compiled as C Code (/TC)
Other info: none
To do: Printing integers from 1 to 10 using for loop C program example
To show: How to use the for loop to print integers from 1 to 10 using the C/C++ for loop
// A simple for statement
#include <stdio.h>
void main(void)
{
int count;
// Display the numbers 1 through 10
for(count = 1; count <= 10; count++)
printf("%d ", count);
printf("\n");
}
Output example:
1 2 3 4 5 6 7 8 9 10
Press any key to continue . . .