| 
November 18th, 2009, 08:02 PM
| | Newbie | | Join Date: May 2007
Posts: 21
Country: Thanks: 3
Thanked 0 Times in 0 Posts
| | 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, | 
November 18th, 2009, 09:38 PM
|  | Grand Panjandrum | | Join Date: Nov 2005 Location: South of England
Posts: 12,274
Country: Thanks: 779
Thanked 4,000 Times in 3,226 Posts
| | Quote:
Originally Posted by turboman 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 | 
November 18th, 2009, 11:30 PM
| | Newbie | | Join Date: May 2007
Posts: 21
Country: Thanks: 3
Thanked 0 Times in 0 Posts
| | Dear Sir,
Thank you for your e-mail but I still do not understand it. Would you mind express it to me?
Cheers, | | Thread Tools | | | | Display Modes | Linear Mode |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | All times are GMT -7. The time now is 10:19 PM. | | |
 | |  |