[E-3]
Write a main()
program that
prints the integers 0 to 14 one per line. Write the integers to standard output.
0 1 2 3 . . . 14
Here is a skeleton of the program.
Complete the for
statement.
Copy and paste the code to Notepad++ or other programming editor
and compile it with gcc.
You can also copy the puzzle to an on-line C compiler: tutorialspoint. Or OnlineGDB.
#include <stdio.h> #include <stdlib.h> /* Puzzle L01 -- print the integers from 0 to 14, one per line */ int main() { int j; for ( ) { printf("%3d\n", j); } /* system("PAUSE"); */ /* Needed for some environments */ return 0; }
Even if the answer is obvious to you, finish the puzzle anyway. Compile it and run it to confirm that it works as you think it should. When you are done, click on the icon to see a suggested answer.