C Source Codes List | Source Code Home
Program : Program to pick and display the largest element of an i/p matrix.
/* Prg. to pick & display the largest element of an i/p matrix */
#include
#include
#include
#define MAXROWS 30
#define MAXCOLS 30
void largest(int a[][MAXCOLS],int nrows,int ncols);
void readinput(int a[][MAXCOLS],int m,int n);
void main()
{
int nrows,ncols;
int a[MAXROWS][MAXCOLS];
clrscr();
printf("How many rows in the matrix? ");
scanf("%d",&nrows);
printf("How many columns in the matrix? ");
scanf("%d",&ncols);
printf("\n\nTable\n");
readinput(a,nrows,ncols);
largest(a,nrows,ncols);
getch();
}
void readinput(int a[][MAXCOLS],int m,int n)
{
int row,col;
for (row=0;rowlargest)
largest=a[i][j];
}
}
printf("\nThe largest element of the matrix is %d",largest);
return;
}
C Source Codes List | Source Code Home
|
|