Largest number in a 5x5 matrix
Write a program to pice up the largest number from any 5 row by 5 column matrix.
#include
#include
void main(void)
{
clrscr();
int arr[5][5],i,k,*fp;
for(i=0;i<5;i++)
{
for(k=0;k<5;k++)
{
printf("Enter the %d row and %d column element:",i+1,k+1);
scanf("%d",&arr[i][k]);
}
}
*fp=arr[0][0];
for(i=0;i<5;i++)
{
for(k=0;k<5;k++)
{
if(*fp
{
*fp=arr[i][k];
}
}
}
printf("%d is the largest of all",*fp);
getch();
}
#include
#include
void main(void)
{
clrscr();
int arr[5][5],i,k,*fp;
for(i=0;i<5;i++)
{
for(k=0;k<5;k++)
{
printf("Enter the %d row and %d column element:",i+1,k+1);
scanf("%d",&arr[i][k]);
}
}
*fp=arr[0][0];
for(i=0;i<5;i++)
{
for(k=0;k<5;k++)
{
if(*fp
*fp=arr[i][k];
}
}
}
printf("%d is the largest of all",*fp);
getch();
}
Comments
Post a Comment