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