Matrix | Sololearn: Learn to code for FREE!

0

Matrix

Dana matrix 7*5. F in nd the sum of all elements in the first rows of the matrix

3/26/2020 10:25:22 AM

Охххymiron

13 Answers

New Answer

+5

Охххymiron We are not here to write your Code. Do self and show your attempts if you are facing any problem.

+1

Finding the sum of all elements in a given row/column requires a simple iteration over the matrix. If you need help with the code, please provide what you have done so far.

+1

Охххymiron Just to reiterate what has been stated, "Please provide what you have done so far". I am not here to write your code, a little work on your side is required. Try to solve it on your own, and if you are stuck, then you can post the code here and we will help you with it.

+1

There were some syntactic errors in the code, I also simplified the initialization a bit and added a variable to control how many rows are summed up. This is the fixed code for now: https://code.sololearn.com/cme3G6mID8T7/?ref=app

0

Yes, I need your help with the code, please write the code and share and give a sign that you have already done.

0

I beg your pardon. Soon, I'll throw the code.

0

#include <iostream> #include <cstdlib> #include <ctime> /* run this program using the con using namespace std; int main() { int n,m, sum=0; srand(time(NULL)); cin>>m; cin>>n; int**mas ; mas=new int*[m]; for (int i=0;i<m;i++) {mas[i]=new int[n];} for(int i-0;i<m;i++) {for(int j=0;j<n;j++) {mas[i][j]= rand()%10; cout<<mas[i][j]<<" "; } cout<<endl;} for(int i-0;i<m;i++) {for (int j=0;j<n;j++) {if(i<3) { sum=sum+mas[i]j];} } } cout<<sum<<" "; return 0; }

0

Yeah, these are the mistakes. Thanks bro

0

https://code.sololearn.com/cmynr979dskB/?ref=app

0

Try using an if statement row is basically the x and Col is y. So trying going with... if x: If y:

-2

Ты просто говорящий рот

-2

НУ И

-2

Бля, чувак это не Isla de muetra