Advertisement
Guest User

Untitled

a guest
Nov 25th, 2014
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #define N 100
  4. #define M 100
  5. int main(){
  6. int n,m,i,j,min=99999999,max=0,a,b,c,d;
  7. int tab[N][M];
  8. scanf("%d %d",&n,&m);
  9. srand(time(NULL));
  10. for(i=0;i<n;i++){
  11.  
  12. for(j=0;j<m;j++){
  13. tab[i][j]=rand()%10;
  14. printf("%d ",tab[i][j]);
  15. if(tab[i][j]>max){
  16. max=tab[i][j];
  17. a=i; //a i b sa indeksami max i i j
  18. b=j;
  19. }
  20. if(tab[i][j]<min){
  21. min=tab[i][j];
  22. c=i;
  23. d=j;
  24. }
  25. }
  26. printf("\n");
  27. }
  28.  
  29.  
  30. printf("max wynosi%d %d",a,b);
  31. printf("min wynosi %d %d",c,d);
  32. return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement