0% found this document useful (0 votes)
3 views1 page

Homework

Uploaded by

monyrachana90
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views1 page

Homework

Uploaded by

monyrachana90
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Name: Seth Monyrachana

Major: Telecommunication
Subject: C++ Programming

Homework

#include<iostream>

using namespace std;

int main(){

int number [3][5]= {{1,2,3,4,5},{6,7,8,9,10}, {11,12,13,14,15}};

for (int i=0 ; i<3 ; i++){

int rowsum = 0;

for (int j=0 ; j<5 ; j++){

rowsum = rowsum + number [i][j];}

cout<<"sum of row"<<i<<" = "<<rowsum<<endl;}

return 0;}

#include <iostream>

using namespace std;

int main (){

int number [2][3] = { {1,2,3}, {4,5,6} };

for(int j = 0; j < 3; j++){

int colSum = 0;

for(int i = 0; i < 2; i++){

colSum = colSum + number [i][j]; }

cout << "Sum of col " << j << " = " << colSum << endl; }

return 0;

You might also like