Array Program10 Find maximum value from 2-D array.

#include<stdio.h>

#include<conio.h>


void main()

{

int i, j, row, column, a[97][97], max;

clrscr();


printf("How many row and column you want enter? ");

scanf("%d", &row);


printf("How many numbers you want as column? ");

scanf("%d", &column);


printf("\nEnter numbers for matrics A\n");

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

{

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

{

printf("Enter number for row:%d and column:%d: ", i+1, j+1);

scanf("%d", &a[i][j]);

}

}


max = a[0][0];

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

{

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

{

if(max < a[i][j])

{

max = a[i][j];

}

}

}


printf("\n\nMax from given array is %d", max);

getch();

}


No comments:

Post a Comment