4 Replies - 6085 Views - Last Post: 19 March 2010 - 07:18 AM Rate Topic: -----

#1 adrian08  Icon User is offline

  • New D.I.C Head

Reputation: -3
  • View blog
  • 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  Icon User is offline

  • D.I.C Regular
  • member icon

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

Re: Turbo C: Highest and Lowest of 10 Inputs

Posted 19 March 2010 - 01:04 AM

[rules][/rules]
Was This Post Helpful? 0
  • +
  • -

#3 adrian08  Icon User is offline

  • New D.I.C Head

Reputation: -3
  • View blog
  • 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?
Was This Post Helpful? 0
  • +
  • -

#4 no2pencil  Icon User is online

  • Head MFIC
  • member icon

Reputation: 5072
  • View blog
  • Posts: 26,465
  • 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.
Was This Post Helpful? 0
  • +
  • -

#5 NickDMax  Icon User is offline

  • Can grep dead trees!
  • member icon

Reputation: 2247
  • View blog
  • Posts: 9,237
  • 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

#2 Start with a basic C program shell:
#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])
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1