2 Replies - 6184 Views - Last Post: 22 November 2011 - 03:12 PM Rate Topic: -----

#1 divide  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 22-November 11

Question about basic pseudocode for a 1x100 multiplication table

Posted 22 November 2011 - 12:06 PM

I am in the most basic steps of learning how to program and right now I am expected to provide basic pseudocode, no set language or anything. The pseudocode I have to create has to be the basic coding for a program that calculates the results for a multiplication table up from 1 to 100 using a nested repetition loop. It also has to print the output for each step and output a new line after 10 items.

This is what I have so far, can anyone tell me if I am on the right path? Is there anything else I need to add? I know it's pretty simple coding but using loops has really confused me.

 
Declare Num1, Num2 As Integer
For (Num1 = 1; Num1 <= 100; Num1++)
For (Num2 =1; Num2 <= 100; Num2++)
Write Num1 * Num2 + " "
End For
Write “new line“
End For



Is This A Good Question/Topic? 0
  • +

Replies To: Question about basic pseudocode for a 1x100 multiplication table

#2 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 4438
  • View blog
  • Posts: 12,308
  • Joined: 18-April 07

Re: Question about basic pseudocode for a 1x100 multiplication table

Posted 22 November 2011 - 12:29 PM

This isn't pseudocode enough. You still have a lot of programming stuctures in there. Remember, pseudocode is english like in structure and you tell each step with the first word preferably being a verb.

Declare two numbers and set them to 1
Execute a loop from 1 to 100
    Execute a loop from 1 to 100
       Set "product" equal to the multiplication of the outer loop index by the inner loop index
       Print "Product"
       If inner loop index is a multiple of 10
           Print carriage return
       End if statement
    End Inner Loop
End Outer Loop



This is just an example and assume what you meant is that after each 10 items of the inner loop insert a carriage return. Not sure why you are saying 1 x 100 when the text you wrote and the pseudocode is saying 100 x 100.

But notice how I have left out any language details like semicolons, ++ operators, parenthesis etc.

:)
Was This Post Helpful? 1
  • +
  • -

#3 divide  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 22-November 11

Re: Question about basic pseudocode for a 1x100 multiplication table

Posted 22 November 2011 - 03:12 PM

Thanks for your help! I only wrote the code as the book explains it (Prelude to Programming). Other than the number mess up on my end (thanks for seeing that!) does my code look fine?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1