fork download
  1. #include <stdio.h>
  2. main ()
  3. {
  4. int num; /* a series of numbers */
  5. int num_squared; /* each number squared */
  6. printf ("TABLE OF SQUARES FOR 1 TO 10\n\n");
  7. printf (" num num squared\n");
  8. printf ("----- -----------\n");
  9. /* loop from 1 to 10 */
  10. for (num = 1; num <= 10; ++num )
  11. {
  12. printf (" %d %d\n", num, num*num);
  13. }
  14. return (0);
  15. }
Success #stdin #stdout 0.01s 5252KB
stdin
Standard input is empty
stdout
TABLE OF SQUARES FOR 1 TO 10

 num num squared
-----     -----------
  1         1
  2         4
  3         9
  4         16
  5         25
  6         36
  7         49
  8         64
  9         81
  10         100