//Largest & smallest matrix number using DMA
#include <stdio.h>
#include <math.h>
void main(){
int a,b,*p,*q,t,c,*r;
printf("ENTER ROWS :\n");
scanf("%d",&a);
printf("ENTER ROWS :\n");
scanf("%d",&b);
int arr[a][b];
printf("ENTER THE MATRIX :\n");
for(int i=0;i<a;i++){
for(int j=0;j<b;j++){
scanf("%d",&arr[i][j]);
}
}
printf("%d * %d matrix :\n ",a,b);
for(int i=0;i<a;i++){
for(int j=0;j<b;j++){
printf("\t%d\t",arr[i][j]);
}
printf("\n");
}
q=&arr[0][0];
r=&arr[0][1];
for(int i=0;i<a;i++){
for(int j=0;j<b;j++){
p=&arr[i][j];
if(*q>=*p){
t=*q;
*q=*p;
*p=t;
}
}
}
for(int i=0;i<a;i++){
for(int j=0;j<b;j++){
p=&arr[i][j];
if(*r<=*p){
c=*q;
*r=*p;
*p=c;
}
}
}
printf("SMALLEST NUMBER IN A MATRIX =%d\n",*q);
printf("LARGEST NUMBER IN A MATRIX =%d\n",*r);
}
To embed this project on your website, copy the following code and paste it into your website's HTML: