Thursday, 21 July 2011

WAP for given matrix A of order m x n .WAP to find row having the maximum number of negative elements. in C++

Do you like this post?
#include
#include
#include
void main()
{
int a[20][20],m,n,count=0,c[20][20],max=0,max1=0;
clrscr();
cout<<"enter rows and columns of matrix:\n"; cin>>m>>n;
for(int i=0;i>a[i][j];
}
}
for(i=0;i {
count=0;
for(int j=0;j {
if(a[i][j]<0)
{
c[i][j]=++count;
}
if(max {
max=count;
max1=i+1;
}
}
cout<<"row containing no of negative terms"< }

cout<<"row containing maximum no of negative elements:"< getch();
}

No comments:

Post a Comment