Math Help Forum

Math Help Forum Feed Site Feed

Go Back   Math Help Forum > University Math Help > Other Advanced Topics
Reply
 
Thread Tools Display Modes
  #1  
Old November 18th, 2009, 08:02 PM
Newbie
 
Join Date: May 2007
Posts: 21
Country:
Thanks: 3
Thanked 0 Times in 0 Posts
turboman is on a distinguished road
Default 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,
Reply With Quote
Advertisement
 
  #2  
Old November 18th, 2009, 09:38 PM
CaptainBlack's Avatar
Grand Panjandrum
 
Join Date: Nov 2005
Location: South of England
Posts: 12,274
Country:
Thanks: 779
Thanked 4,000 Times in 3,226 Posts
CaptainBlack has a reputation beyond reputeCaptainBlack has a reputation beyond reputeCaptainBlack has a reputation beyond reputeCaptainBlack has a reputation beyond reputeCaptainBlack has a reputation beyond reputeCaptainBlack has a reputation beyond reputeCaptainBlack has a reputation beyond reputeCaptainBlack has a reputation beyond reputeCaptainBlack has a reputation beyond reputeCaptainBlack has a reputation beyond reputeCaptainBlack has a reputation beyond repute
Default

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
__________________
Truth does not change because it is, or is not, believed by a majority of the people.

Giordano Bruno
Reply With Quote
  #3  
Old November 18th, 2009, 11:30 PM
Newbie
 
Join Date: May 2007
Posts: 21
Country:
Thanks: 3
Thanked 0 Times in 0 Posts
turboman is on a distinguished road
Default

Dear Sir,

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

Cheers,
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off
Forum Jump


All times are GMT -7. The time now is 10:19 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 ©2008, Crawlability, Inc.
©2005 - 2009 Math Help Forum


Math Help Forum is a community of maths forums with an emphasis on maths help in all levels of mathematics.
Register to post your math questions or just hang out and try some of our math games or visit the arcade.