Advertisement
LegoDrifter

najdi go najgolemiot sasa matic i najmaliot sasa matic

Jan 20th, 2020
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. #include <stdio.h>
  2. void main()
  3. {
  4. int m[50][50],n,j,i,min,max;
  5. scanf("%d",&n);
  6. for(i=0;i<n;i++)
  7. {
  8. for(j=0;j<n;j++)
  9. {
  10. printf("Element [%d][%d]:",i,j);
  11. scanf("%d",&m[i][j]);
  12. }
  13. }
  14. for(i=0;i<n;i++)
  15. {
  16. for(j=0;j<n;j++)
  17. {
  18. printf("%d ",m[i][j]);
  19. }
  20. printf("\n");
  21. }
  22. for(i=0;i<n;i++)
  23. {
  24. for(j=0;j<n;j++)
  25. {
  26. if(i==0&&j==0)
  27. {
  28. min=max=m[i][j];
  29. }
  30. else if(m[i][j]>max)
  31. {
  32. max=m[i][j];
  33. }
  34. else if(m[i][j]<min)
  35. {
  36. min=m[i][j];
  37. }
  38. }
  39. }
  40. printf("%Ispecati go najgolemiot element %d, a najmaliot %d",max,min);
  41.  
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement