Minimum & Maximum Element In MatrixCode CrazeFeb 24, 20231 min read#include <stdio.h>void main() { int a[100][100]; int r, c; int i, j; int max; int min; printf("\nEnter rows : "); scanf("%d", &r); printf("\nEnter columns : "); scanf("%d", &c); for(i=0;i<r; i++) { for(j=0;j<c; j ++) { printf("\nEnter %d, %d element : ",i, j); scanf("%d",&a[i][j]); } } printf("\n----Matrix----\n"); for(i=0;i<r; i++) { for(j=0;j<c; j ++) { printf("%d ",a[i][j]); } printf("\n"); } max=a[0][0]; printf("\n----Maximum----\n"); for(i=0;i<r; i++) { for(j=0;j<c; j ++) { if(max<a[i][j]) { max=a[i][j]; } } } printf("Maximum : %d", max); min=a[0][0]; printf("\n\n----Minimum----\n"); for(i=0;i<r; i++) { for(j=0;j<c; j ++) { if(min>a[i][j]) { min=a[i][j]; } } } printf("\n Minimum : %d", min);}
#include <stdio.h>void main() { int a[100][100]; int r, c; int i, j; int max; int min; printf("\nEnter rows : "); scanf("%d", &r); printf("\nEnter columns : "); scanf("%d", &c); for(i=0;i<r; i++) { for(j=0;j<c; j ++) { printf("\nEnter %d, %d element : ",i, j); scanf("%d",&a[i][j]); } } printf("\n----Matrix----\n"); for(i=0;i<r; i++) { for(j=0;j<c; j ++) { printf("%d ",a[i][j]); } printf("\n"); } max=a[0][0]; printf("\n----Maximum----\n"); for(i=0;i<r; i++) { for(j=0;j<c; j ++) { if(max<a[i][j]) { max=a[i][j]; } } } printf("Maximum : %d", max); min=a[0][0]; printf("\n\n----Minimum----\n"); for(i=0;i<r; i++) { for(j=0;j<c; j ++) { if(min>a[i][j]) { min=a[i][j]; } } } printf("\n Minimum : %d", min);}
Stack Using QueueA stack can be implemented using two queues in C. The basic idea is to use one queue for enqueue operations and another for dequeue...
Kommentare