Results 1 to 3 of 3

Math Help - The problem in Algorithms

  1. #1
    Newbie
    Joined
    May 2007
    Posts
    21

    The problem in Algorithms

    Please help me to work on the following question:

    Consider the following sequence of steps:

    1. count:=0
    2. answer:=5
    3. while count<=9 do
    3.1 count:=count+2
    3.2 answer:=answer+count
    4. output answer

    b. Construct a trace table to show the value of all variables.
    c. What is the value of answer after 3 iterations of the for-do loop?
    d. Is the sequence of steps an algorithm? Giv a reason for your answer.

    Please help to solve the above problem.

    Cheers,
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by turboman View Post
    Please help me to work on the following question:

    Consider the following sequence of steps:

    1. count:=0
    2. answer:=5
    3. while count<=9 do
    3.1 count:=count+2
    3.2 answer:=answer+count
    4. output answer

    b. Construct a trace table to show the value of all variables.
    c. What is the value of answer after 3 iterations of the for-do loop?
    d. Is the sequence of steps an algorithm? Giv a reason for your answer.

    Please help to solve the above problem.

    Cheers,
    Do you know what a trace table is? An explanation is given here and here.

    CB
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Newbie
    Joined
    May 2007
    Posts
    21
    Dear Sir,

    Thank you for your e-mail but I still do not understand it. Would you mind express it to me?

    Cheers,
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. algorithms
    Posted in the Discrete Math Forum
    Replies: 2
    Last Post: March 16th 2010, 02:25 PM
  2. Replies: 8
    Last Post: December 18th 2009, 08:18 PM
  3. Algorithms
    Posted in the Discrete Math Forum
    Replies: 2
    Last Post: December 17th 2009, 07:11 AM
  4. A problem in Algorithms
    Posted in the Math Topics Forum
    Replies: 0
    Last Post: November 7th 2009, 12:48 AM
  5. Algorithms
    Posted in the Discrete Math Forum
    Replies: 1
    Last Post: March 4th 2009, 11:33 AM

Search Tags


/mathhelpforum @mathhelpforum