My photo
Bangalore, Karnataka, India
Extending one hand to help someone has more value rather than joining two hands for prayer

Archives

program to find the largest number in each row of the matrix?

Tuesday, September 1, 2009

#include<iostream.h>
#include<conio.h>
void main()
{
 clrscr();
 int x[10][10],m,n;
 cout<<"number of rows and columns"<<endl;
 cin>>m>>n;
 for(int i=0;i<m;i++)
 {
  int largest=0;
  for(int j=0;j<n;j++)
  {
   cin>>x[i][j];
   if(x[i][j]>largest)
   largest=x[i][j];
   }
 cout<<"largest number of "<<i+1<<" row: "<<largest<<endl;
 }
 getch();
 }

0 comments: