# Writing an Algorithm (not a programming problem)

Page 1 of 1

## 4 Replies - 1718 Views - Last Post: 13 September 2012 - 02:19 PM

### #1 Nienna426

• New D.I.C Head

Reputation: 0
• Posts: 2
• Joined: 13-September 12

# Writing an Algorithm (not a programming problem)

Posted 13 September 2012 - 01:26 PM

The assignment is: Write an algoright(a step-by-step set of instructions) for the following problem: [you must approach this problem as if you were explaining the procedure to a machine]

You are to calculate the average test score for a student. The student has taken 10 test. There should be a loop to input the test scores. You do not need to store the scores in a list, but you can do so if you want. Otherwise, just add them up as you input them. Calculate and output the average. If the average is less than 60.0, print out the message, "You need to get extra help".

This is what I've done so far:
Output “Do you wish to do another calculation?”
Input response
Repeat until response equals n
{
Output “Please enter the scores”
Input L[i]
Set i to 0
Repeat until i equals 9
{
Calculate (L[0]+L[1]+L[2]+L[3]+L[4]+L[5]+L[6]+L[7]+L[8]+L[9])/10
Set i to i+1
}
If score<60.0
Output “You need to get extra help”
Otherwise
Do nothing.
Output “Do you wish to do another calculation?”
Input response
}
Output “Done”

Is This A Good Question/Topic? 0

## Replies To: Writing an Algorithm (not a programming problem)

### #2 xclite

• I wrote you an code

Reputation: 974
• Posts: 3,409
• Joined: 12-May 09

## Re: Writing an Algorithm (not a programming problem)

Posted 13 September 2012 - 01:28 PM

Are you asking for feedback, or do you have a specific problem you'd like advice with?
Was This Post Helpful? 0

### #3 Nienna426

• New D.I.C Head

Reputation: 0
• Posts: 2
• Joined: 13-September 12

## Re: Writing an Algorithm (not a programming problem)

Posted 13 September 2012 - 01:39 PM

I'm looking for feedback, corrections on my work so that it is going to work when I hand it in

I'm pretty sure that is not completely correct
Was This Post Helpful? 0

### #4 mojo666

• D.I.C Addict

Reputation: 376
• Posts: 815
• Joined: 27-June 09

## Re: Writing an Algorithm (not a programming problem)

Posted 13 September 2012 - 01:45 PM

Quote

Set i to 0
Repeat until i equals 9
{
Calculate (L[0]+L[1]+L[2]+L[3]+L[4]+L[5]+L[6]+L[7]+L[8]+L[9])/10
Set i to i+1
}
If score<60.0

This does not make much sense. You calculate the average 10 times. You seem to understand that you need to loop. It needs to look like the following.

Set sum to 0
Set i to 0
Repeat until i equals 9
{
/*Fill in the missing instruction*/
Set i to i+1
}
set score to /*calculated average based on loop results*/
If score<60.0
Was This Post Helpful? 0

### #5 AdamSpeight2008

• MrCupOfT

Reputation: 2290
• Posts: 9,528
• Joined: 29-May 08

## Re: Writing an Algorithm (not a programming problem)

Posted 13 September 2012 - 02:19 PM

An algorithm is steps you need to follow to accomplish a task.
Eg;- Cup of Tea making algorithm.
Potwashing Alogrithm
Calculating an Average Algorithm

It should be a series of written English (preferable) statements. ** NOT CODE **
Was This Post Helpful? 0

Page 1 of 1

 .related ul { list-style-type: circle; font-size: 12px; font-weight: bold; } .related li { margin-bottom: 5px; background-position: left 7px !important; margin-left: -35px; } .related h2 { font-size: 18px; font-weight: bold; } .related a { color: blue; }