WAP in C to find the sum of each rows of a matrix?

#include<stdio.h>
#include<conio.h>
int main()
{
int array[10][10];
int i,j,m,n,sum=0;
clrscr();
printf(“Enter the order of the matrix”);
scanf(“%d %d”,&m,&n);
printf(“Enter the co-efficients of the matrix\n”);
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
scanf(“%d”, &array[i][j]);
}
}
for (i=0;i<m;i++)
{
for (j=0;j<n;j++)
{
sum = sum + array[i][j] ;
}
printf(“Sum of the %d row is = %d\n”, i, sum);
sum = 0;
}
getch();
return(0);
}

Output :-

sumrow

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s