gabrielaozegovic

Untitled

Jun 29th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. #include <stdio.h>
  2. #include<time.h>
  3. #include<stdlib.h>
  4.  
  5. #define R 5
  6. #define S 5
  7.  
  8. #ifndef DEBUG
  9. #define DEBUG(...)printf(__VA_ARGS__)
  10. #endif
  11.  
  12. int main(){
  13. int i, j, mat[R][S], polje[99]={};
  14.  
  15. for(i=0; i<R; i++){
  16. for(j=0; j<S; j++){
  17. mat[i][j]=rand()%99 + 1;
  18. }
  19. }
  20.  
  21. for(i=0; i<R; i++){
  22. for(j=0; j<S; j++){
  23. printf("%4d", mat[i][j]);
  24. }
  25. printf("\n");
  26. }
  27.  
  28.  
  29. for(i=0; i<R; i++){
  30. for(j=0; j<S; j++){
  31. polje[mat[i][j]]++;
  32. }
  33. }
  34.  
  35. for(i=0; i<99; i++){
  36. if(polje[i])
  37. printf("%d -> %d\n", i, polje[i]);
  38.  
  39. }
  40.  
  41.  
  42. return 0;
  43. }
Add Comment
Please, Sign In to add comment