I'm trying to convert my pseudocode below into a COBOL program to calculate the average of any number of positive integers, with the following requirements: Limit the number of integers to 15.  I.e. Accept 2-15 positive integers Ensure the output instructions to the user are clear. Assume the user is always entering valid data. (No validation in this assignment needed) Display the Average with two decimal places. Begin Sum = 0 n = 0 Loop Take New Input If input > 0 and n < 15 Then { Sum = Sum + Input n = n + 1 } Else{ End Loop } avg = sum/n print avg End

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter4: Selection Structures
Section4.5: A Case Study: Solving Quadratic Equations
Problem 4E
icon
Related questions
Question

I'm trying to convert my pseudocode below into a COBOL program to calculate the average of any number of positive integers, with the following requirements:

  • Limit the number of integers to 15.  I.e. Accept 2-15 positive integers
  • Ensure the output instructions to the user are clear.
  • Assume the user is always entering valid data. (No validation in this assignment needed)
  • Display the Average with two decimal places.

Begin

Sum = 0

n = 0

Loop

Take New Input

If input > 0 and n < 15 Then {

Sum = Sum + Input

n = n + 1

}

Else{

End Loop

}

avg = sum/n

print avg

End

 

Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Structure chart
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage