Answer to Question #210898 in C for genji 3

Question #210898

Write C program to find the maximum number from the n x m array.


1
Expert's answer
2021-06-28T07:24:09-0400


//Write C program to find the maximum number from the n x m array.
main(void)
{
	int Array[4][3] = 	{
							{2, 30, 5},
							{20, 10, 50},
							{12, 42, 55},
							{23, 7, 8}
						};
	int Max,n,m,r,c;
	n = sizeof(Array)/sizeof(Array[0]);
	m = sizeof(Array[0])/n;
	
	Max = Array[0][0];
	printf("\nInput Array:\n");
	for(r=0;r<n;r++)
	{
		for(c=0;c<m;c++)
		{
			printf("%5d",Array[r][c]);
			if(Array[r][c]>=Max) Max = Array[r][c];
		}
		printf("\n");
	}
	printf("\nGiven Array Size:\tn = %d, m = %d",n,m);
	printf("\n\nThe maximum element in Array: %d",Max);
	return(0);


}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS