Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- // Da se najde najmal i najgolem element od matricata.
- int main()
- {
- int m,n,i,j,mini,maxi,a[100][100];
- printf("Vnesi golemina na matricata\n");
- scanf("%d%d", &m, &n);
- for(i=0;i<n;i++)
- {
- for(j=0;j<m;j++)
- {
- scanf("%d", &a[i][j]);
- }
- }
- mini = a[0][0];
- maxi = a[0][0];
- for(i=0;i<n;i++)
- {
- for(j=0;j<m;j++)
- {
- if(a[i][j] < mini)
- mini = a[i][j];
- if(a[i][j] > maxi)
- maxi = a[i][j];
- }
- }
- printf("%d E najmal element\n", mini);
- printf("%d E najgolem element\n", maxi);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement