Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and the Yahoo Answers website is now in read-only mode. **There will be no changes to other Yahoo properties or services, or your Yahoo account.** You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

## Trending News

# in c please?

Write a program to perform calculations on three user floating-point numbers between 0 and 100 inclusive and print the results with different formatting.

• Prompt the user to "Enter 3 floating-point numbers between 0 and 100 inclusive: "

• If the data is outside that range, print "THE DATA IS INVALID!". Otherwise, do the following calculations:

• Print "Average using scientific notation: " followed by the correct number.

• Print "Square root of the average to eight decimal places: " followed by the correct number.

• Print "Rounded average: " followed by the correct number.

• Print "Integer average: " followed by the correct number whether it's odd or even in parenthesis.

A sample run with three good numbers:

Enter 3 floating-point numbers between 0 and 100 inclusive:

23.456789

45.6789

67.89

Average using scientific notation: 4.567523e+01

Square root of the average to eight decimal places: 6.75834519

Rounded average: 46

Integer average: 45 (odd)

### 3 Answers

- BigELv 72 months ago
You can split this up. The first is the input, you can use the sscanf fscanf routines, they can validate the data for you.

For the calc, just take the example and put them in 3 variables and figure out the calc and format..

Put the 2 together, there you go.

- ?Lv 72 months ago
yes you should definitely be able to do this very basic thing, if you expect to be a programmer, which requires much more complicated problems to be solved...

- Anonymous2 months ago
declare an array of floats to hold the three numbers.

while you have less than three numbers { get input, if the input is good store it and increment the index else complain }

calculate and print each result.