#include <stdio.h> #include <stdlib.h> /* Puzzle A01 -- print the integers from 0 to 14, one per line */ int main(int argc, char *argv[]) { int j; for (j=0; j<15; j++ ) { printf("%3d\n", j); } system("PAUSE"); return 0; }
Comments: This is the usual way to count from 0 to 14. It
also works to use this for
statement:
for (j=0; j<=14; j++ )
The system("PAUSE")
is needed if you run the program
within the Dev-C++ environment. Without it, the DOS window
vanishes when the program reaches the end and you will not
be able to see the output.