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