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