Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int mat[100][100], n, m, i, j, maxim = -100000, minim = 100000;
- int main()
- {
- cout<<"n= "; cin>>n;
- cout<<"m= "; cin>>m;
- for(i = 0; i < n; i++)
- {
- for(j = 0; j < m; j++)
- {
- cout<<"mat["<<i<<"]["<<j<<"]= "; cin>>mat[i][j];
- }
- }
- for(i = 0; i < n; i++)
- {
- for(j = 0; j < m; j++)
- {
- if(mat[i][j] > maxim)
- maxim = mat[i][j];
- if(mat[i][j] < minim)
- minim = mat[i][j];
- }
- }
- cout<<"Maximul este "<<maxim<<endl;
- cout<<"Minimul este "<<minim<<endl;
- cout<<"Diferenta = "<<maxim - minim;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement