Thursday
March 23, 2017

Post a New Question

Posted by on Sunday, March 11, 2012 at 6:44pm.

Write a program (pseudocode) that would calculate and display the results for the multiplication table for values ranging from 1 to 100.

This what I have so far:
Declare X, Y, Z As Integer
Write “10 x 10 Multiplication Table”
For (X = 1; X<=10; X++)
For (Y = 1; Y<=10; Y++)
Set X * Y = Z
Write Z
End For(Y)
End For(X)

But I believe this would write everything on a separate line, and I need it to write in a 10x10 table manner.

  • Programming - , Sunday, March 11, 2012 at 9:01pm

    Congratulations, this is an excellent pseudocode!

    There are only a few small details to attend to.

    You have already mentioned about presentation in a table form. Yes, this takes a little attention.

    Unfortunately, the physical mechanism for tabulation varies from one language to the other. However, most languages (including Java, C, C++, Visual Basic Fortran and many others) have a way to limit output to a specified number of characters, and to control whether to continue output on the same line or to skip to a new line.
    So all you have to do is to replace "Write Z" by a generic statement like:
    "Write Z in fixed format, right-justified 5 characters"
    And insert a command
    "Skip to newline"
    between End For(Y) and End For(X).
    That will take care of the presentation.

    Furthermore, if you like, you can also indicate the multiplier and multiplicand at the top and on the left to make it look like a real multiplication table. This is a little more complicated, but not difficult.

    If you like to give it a try, I will be glad to look over your pseudocode.

Answer This Question

First Name:
School Subject:
Answer:

Related Questions

More Related Questions

Post a New Question