Computer Science, asked by ankitbehera22782, 9 months ago

Write a program to create double dimensional array of 4×4 and display sum of each row​

Answers

Answered by Soñador
0

#include<iostream.h>

#include<conio.h>

void input(int a[4][4],int r, int c)

{

//loop for input

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

{

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

{

cout<<"\nEnter any number";

cin>>a[i][j];

}

}

}

void sum(int a[4][4],int r, int c)

{

// Loop for Row Sum

for( i=0; i<c; i++ )

{

r[i]=0;

for( j=0; j<c; j++ )

r[i] = r[i] + a[i][j];

cout<<r[i]<<endl;

}

}

void main()

{

clrscr();

int a[4][4],r=4, c=4;

input(a,r,c);

sum(a,r,c);

getch();

}

Similar questions