Let Us C (Chapter 8 : Arrays) : Program-10

(j) Write a program to pick up the largest number from any 5 row by 5 column matrix.

let us c chapter 8 arrays problem 10



// Let Us C (Chapter 8 : Arrays) : Program-10
/* Write a program to pick up the largest number from any 5 row by 5 column matrix */

#include<stdio.h>
long int Arr[5][5],Largest;
unsigned Write a program to pick up the largest number from any 5 row by 5 column matrix. i,j;
void main()
{
	clrscr();
	printf("Enter 25 elements of 5x5 matrix\n");
	for(i=0;i<5;i++)
	{
		for(j=0;j<5;j++)
		{
			printf("Enter [%d][%d]th element: ",i,j);
			scanf("%ld",&Arr[i][j]);
		}
	}
	Largest = Arr[0][0];
	printf("\nEntered Matrix is : \n");
	for(i=0;i<5;i++)
	{
		for(j=0;j<5;j++)
		{
			printf("%8ld ",Arr[i][j]);
			if(Largest < Arr[i][j])
				Largest = Arr[i][j];
		}
		printf("\n");
	}
	printf("\nLargest element is : %ld",Largest);
}
OUTPUT

let us c chapter 8 arrays problem 10 output


Comments

Popular posts from this blog

Chapter 5 : Functions & Pointers (Let us C)

Let Us C (Chapter 8 : Arrays) : Program-9

Chapter 3: The Loop Control Structure (Let Us C)