Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Extend the program below so that it also calculates the average of all numbers between 18 and 30. Use a separate loop. Try as well
Extend the program below so that it also calculates the average of all numbers between 18 and 30. Use a separate loop. Try as well to: 1) Use functions 2) make the program flexible enough to compute the average of values within any other range.
Code: #includeusing namespace std; void readData(int, *data, int sz){ } int main(){ //set size of array and create it int sz = 0; int arr[sz]; cout<<"enter num data: "< >sz; int *data = new int[sz]; //int data[5]; cout<<"Data is "<>data[i]; } //loop 2:calculate the average int sum = 0; for (int i=0; i
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started