Question: What will be displayed by the following code? #include using namespace std; const int COLUMN _ SIZE = 3 ; double sum ( const double

What will be displayed by the following code?
#include
using namespace std;
const int COLUMN_SIZE =3;
double sum(const double m[][COLUMN_SIZE], int rowSize)
{
int sum =0; // Please note sum is declared int here
for (int i =0; i < rowSize; i++)
sum += m[i][i];
return sum;
}
int main()
{
double m[3][3]={{1,2,3},{1.5,2.5,3.5},{0.1,0.1,0.1}};
cout <<"
Sum of all elements is"<< sum(m,3)<< endl;
return 0;
}

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 Databases Questions!