Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(void) {
- // Variables
- int counter, square;
- // Constant for the maximum value
- const int MAX_VALUE = 10;
- // Display table headings.
- printf("Number\tSquare\n");
- printf("----------------\n");
- // Display the numbers 1 through 10 and
- // their squares.
- for (counter = 1; counter <= MAX_VALUE; counter++)
- {// Calculate number squared.
- square = counter * counter;
- // Display number and number squared.
- printf(" %d \t\t %d\n", counter, square);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement