Advertisement
Guest User

Untitled

a guest
Feb 18th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. int[] hivottr = new int[db];
  2. int[] hivottdb = new int[db];
  3. for (int i = 0; i < db; i++)
  4. {
  5. hivottr[i] = szam[i];
  6. }
  7. for (int i = 0; i < db; i++)
  8. {
  9. for (int j = 0; j < db; j++)
  10. {
  11. if (hivottr[i] == szam[j])
  12. {
  13. hivottdb[i]++;
  14. }
  15. }
  16. }
  17. int hivottmax = 0;
  18. int maxhivott = 0;
  19. for (int i = 0; i < db; i++)
  20. {
  21. if(hivottdb[i]>hivottmax)
  22. {
  23. hivottmax = hivottdb[i];
  24. maxhivott = hivottr[i];
  25. }
  26. }
  27.  
  28. Console.WriteLine("7. feladat: Legtöbbször a(z) {0} számot hívta, {1} hívással.", maxhivott, hivottmax);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement