Lexington High School Mathematics Math Dept. Front Page  | Student Links  | Family Links 
Introduction to C++, Kevin Kelly Kelly Front Page  | C++ Course Guide | C++ Assignments | C++ Info

Assignment 21: Multiplication table

due Monday 4/8

Write a program that computes and prints out a 12-by-12 multiplication chart. Your program must use a nested loop (a loop inside another loop).

Some specific requirements about what the chart should look like:



Extensions

For 5 pts.: Write a program that will print an n-by-n multiplication chart, for a user-input value of n. Provide sample runs with input values of 12 and 18.

For 10 pts.: Also make your program calculate the column width based on n, so that the program always uses the smallest possible column width (i.e., if the column width were 1 less, some numbers in the chart would run into each other). Provide sample runs with input values of 3, 4, 9, 10, 12, 18, and 20.