Advertisement
valve2

test

Jan 19th, 2023 (edited)
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.56 KB | Source Code | 0 0
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4.     // Variables
  5.     int counter, square;
  6.     // Constant for the maximum value
  7.     const int MAX_VALUE = 10;
  8.     // Display table headings.
  9.     printf("Number\tSquare\n");
  10.     printf("----------------\n");
  11.  
  12.     // Display the numbers 1 through 10 and
  13.     // their squares.
  14.     for (counter = 1; counter <= MAX_VALUE; counter++)
  15.     {// Calculate number squared.
  16.         square = counter * counter;
  17.         // Display number and number squared.
  18.         printf("  %d \t\t %d\n", counter, square);
  19.     }
  20.     return 0;
  21. }
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement