Puzzle L1


Print the integers from 0 to 14, one per line

[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. Finish it by completing the for statement. With a programming environment (such as Bloodshed Dev-C++) use copy-and-paste to copy this code into the editor window and then save it to a source file.

You can also copy the puzzle to on-line C compiler: tutorialspoint.

#include <stdio.h>
#include <stdlib.h>

/* Puzzle L01 -- print the integers from 0 to 14, one per line */
int main(int argc, char *argv[])
{
  int j;
  for (     )
  {
    printf("%3d\n", j);
  }
  /* system("PAUSE");	*/     /* Un-comment for Dev-C++ or VC++ */
  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.



Answer         Next Page         Previous Page Home