How to write a C Program to Print Maximum and Minimum Number in Row and Column in C Programming Language ?
This C Program to Print Maximum and Minimum Number in Row and Column.
Solution:
- #include<stdio.h>
- int main()
- {
- int ar[100][100], row, col, i , j, max,min, max2;
- printf("row = ");
- scanf("%d", &row);
- printf("column = ");
- scanf("%d", &col);
- for(i = 0 ; i < row ; i++)
- {
- for(j = 0 ; j < col ; j++)
- {
- printf("ar[%d][%d] = ", i, j);
- scanf("%d", &ar[i][j]);
- }
- }
- max = ar[0][0];
- min = ar[0][0];
- for(i = 0 ; i < row ; i++)
- {
- for(j = 0 ; j < col ; j++)
- {
- if(max < ar[i][j])
- {
- max = ar[i][j];
- }
- if(min > ar[i][j])
- {
- min = ar[i][j];
- }
- }
- }
- max2 = ar[0][0];
- for(i = 0 ; i < row ; i++)
- {
- for(j = 0; j < col ; j++)
- {
- if(max2 < ar[i][j])
- {
- if(ar[i][j] == max)
- {
- continue;
- }
- max2 = ar[i][j];
- }
- }
- }
- printf("maximum number : %d\nminimum number : %d\nsecond maximum number : %d\n",max, min, max2);
- return 0;
- }
Learn More :
Minimum
- C Program To Find The Maximum And Minimum Value In An Array
- Max count of chars, Max count of nums and Max count of signs
- C Program to Find max and min in array using pointer concept
- C Program to accept n numbers from user, store these numbers into an array. Find out Maximum & Minimum number from an Array
Row
Column
Maximum
- Write a C program to find maximum or equal between two numbers ?
- How to Write a C program to find maximum between two numbers ?
- Write a C program to find maximum between three numbers ?
- C program to Given a vector (integer or real), determine what is the maximum value of element what is the position in which this element is located
- C Program To Find The Maximum And Minimum Value In An Array
- C Program To Find Maximum Of Given Numbers
- Max count of chars, Max count of nums and Max count of signs
- C Program to Find max and min in array using pointer concept
- C Program to accept n numbers from user & find out the maximum element out of them by using dynamic memory allocation
- C Program to accept n numbers from user, store these numbers into an array. Find out Maximum & Minimum number from an Array