Question

Write an algorithm that gets as input three data values x, y, and z and outputs...

Write an algorithm that gets as input three data values x, y, and z and outputs the average of these values if the value of x is positive. If the value of x is either 0 or negative, your algorithm should not compute the average but should print the error message ' Bad data' instead.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Algorithm to find Average of three Numbers is given below:

Step 1: Start
Step 2: Input 3 values x,y,z
Step 3: initialize average to 0

Step 3: If x > 0 then
          average <-- (x+y+z)/3
          print average
          
       else if x <= 0
          print "Bad Data"
Step 4 : Stop

Add a comment
Know the answer?
Add Answer to:
Write an algorithm that gets as input three data values x, y, and z and outputs...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT