Computer Science, asked by araufkamara, 11 months ago

Write an algorithm for finding the average of 3 numbers. Represent your results also using a flow chart. Determine the decision logic in your answer and explain why?

Answers

Answered by StaceeLichtenstein
1

Following are the algorithm and flowchart of average of 3 numbers is given below

Explanation:

Algorithm

Step 1:Read the three value by the user x,y,z respectively.

Step 2: If the entered number is negative then go to Step 1  and again read the value by user

Step 3: Declared a variable s=0 for sum and avg1 for average .

Step 4: Calculating sum in s variable

              s=x+y+z;

Step 5: Calculated the average

            avg1=s/3;

Step 6: Display avg1

Decision logic

The decision logic is for positive number only because the average cannot be negative value .

Step 2: If the entered number is negative then go to Step 1  and again read the value by user

Step 3: Declared a variable s=0 for sum and avg1 for the average .

Step 4: Calculating sum in s variable

              s=x+y+z;

Step 5: Calculated the average

            avg1=s/3;

Step 6: Display avg1

Following are the Flowchart is given below

Learn More :

  • brainly.in/question/17549479
Attachments:
Similar questions