1.

Write a user defined function in C++ to display the sum of row elements of two dimensional array A[5][6] containing integers.

Answer»

void RowSum(int A[5][6])

{ int SUMC[5];

for(int i=0;i<5;i++)

{ SUMC[i]=0;

for(int j=0;j<6;j++)

SUMC[i]+=A[i][j];

cout<<"Sum of row"<<i+1<<"="<< SUMC[i]<<end1;

}

}



Discussion

No Comment Found

Related InterviewSolutions