Question: function+array add function for the code below to find the sum of secondary elements the sum of element above main diagonal the sum of element
function+array add function for the code below to find the sum of secondary elements the sum of element above main diagonal the sum of element below main diagonal the average of all elements in c++ for beginners please
// Example program
#include
#include
#include
#include
using namespace std;
//recursive functions
const int size=10;
void fill(int x[size][size])
{
for (int i=0;i { for(int j=0;j x[i][j]=rand()%66+35; } } void print(int x[size][size]) { for (int i=0;i { for (int j=0;j cout<< x[i][j]<<"\t"; cout< } } int sum_main_d(int x[size][size]) { int s=0; for (int i=0;i s+=x[i][i]; return s; } int main() { srand(time(0)); int array1[size][size]; fill(array1); print(array1); cout<<"The sum of main diagonal is :"< }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
