# Turbo C: Highest and Lowest of 10 Inputs

Page 1 of 1

## 4 Replies - 9619 Views - Last Post: 19 March 2010 - 07:18 AMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=162918&amp;s=619e91ca4f69f9220af9c6cb13bf0aa1&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

Reputation: -3
• Posts: 3
• Joined: 19-March 10

# Turbo C: Highest and Lowest of 10 Inputs

Posted 19 March 2010 - 01:00 AM

display the highest and lowest value from the maximum of 10 inputs
Is This A Good Question/Topic? 0

## Replies To: Turbo C: Highest and Lowest of 10 Inputs

### #2 muballitmitte

• D.I.C Regular

Reputation: 174
• Posts: 470
• Joined: 05-November 08

## Re: Turbo C: Highest and Lowest of 10 Inputs

Posted 19 March 2010 - 01:04 AM

[rules][/rules]

Reputation: -3
• Posts: 3
• Joined: 19-March 10

## Re: Turbo C: Highest and Lowest of 10 Inputs

Posted 19 March 2010 - 02:14 AM

how to make a program in turbo c that solve for the sum and average in a maximum of 10 grade input and display also the highest and lowest value?

### #4 no2pencil

• Professor Snuggly Pants

Reputation: 5965
• Posts: 29,143
• Joined: 10-May 07

## Re: Turbo C: Highest and Lowest of 10 Inputs

Posted 19 March 2010 - 02:47 AM

Loop the numbers, adding up their values & storing them into a variable, & then divide by 10. This can be completed with simple code at the beginner level. Please give this a try 1st.

### #5 NickDMax

Reputation: 2254
• Posts: 9,245
• Joined: 18-February 07

## Re: Turbo C: Highest and Lowest of 10 Inputs

Posted 19 March 2010 - 07:18 AM

how to:

#1 Start by taking a moment to plan out what you would like the program to do, and try to think basically what functionality you will need:
a. get user input for up to 10 grades and store in an array. Keep a count of number of inputs.
b. loop though inputs and find sum, min, and max.
c. calculate average

```#include <stdio.h>
#include <stdlib.h>

int main() {
//TODO: Program entry point

return 0;
}
```

#3 Program in baby steps.
a. Write a program that gets the input for up to 10 grades
a.1. compile, correct any compiler errors and compile again (I typically try to compile about once every 10-20 lines).
a.2. test input. Remember users are stupid and may not always follow directions, test what happens when you user is an idiot.
a.3. make corrections based upon test results.

b. Extend the program to loop over the numbers and calculate the sum, min and max
b.1. compile, correct any compiler errors and compile again.
b.2. test.
b.3. fix any errors based upon test results.

c. add in the average calculation

Note when in development you may add printf() lines to help see what is going on, and remove later (called debugging lines).

If you get stuck with some compiler error or stuck on a test, then post your code here (remember to use code tags, the little <> button in the editor, or [code] ...paste code here... [/code])