Question: Modify this code: #include using namespace std; int main ( ) { const int size = 5 ; int array 1 [ size ] ;

Modify this code:
#include
using namespace std;
int main()
{
const int size =5;
int array1[size];
double avg;
double sum =0.0;
cout<< "Please enter 5 values: "<> array1[i];
sum = sum + array1[i];
}
avg = sum / size;
cout << "You entered: ";
int max = array1[0];
for(int i =0 ; i< size ; i++){
cout<< array1[i]<<"";
if(max < array1[i]){
max = array1[i];
}
}
cout<<" And the maximum number entered is : "<< max<< endl;
cout<< "The summation of the entered values is: "<< sum<< endl;
cout<< "The average of the entered values is: "<< avg;
}
e. Create a function and name it as CalAvg and the function accepts two integer arguments and
return one double. The function accepts integer array1 and the size of the array1. And the
function returns the average of the entered values.
f. Use your ID number digits as values stored in a two dimensional array. Write a C++ program
to:
a. Display the two dimensional array in 3 columns and 3 rows. i.e. if your id is 342169510, the
two dim array will be:
342
169
510
b. Display the two dimensional array in 3 columns and 3 rows multiplied by itself. i.e. if your
id is 34210956. The resulted output will be:
9164
13681
2510

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Finance Questions!