Advertisement
Guest User

Untitled

a guest
May 27th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.52 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <stdlib.h>
  4.  
  5. int najczestszy(int ilosc,int tab[]){
  6.     int licznik,wartosc,maxwartosc,maxlicznik;
  7.     maxlicznik=0;
  8.     maxwartosc=0;
  9.     for (int i = 0; i < ilosc; ++i) {
  10.         wartosc=tab[i];
  11.         licznik=0;
  12.         for (int j = 0; j < ilosc; ++j) {
  13.             if (tab[j]==wartosc) licznik++;
  14.         }
  15.         if (licznik>maxlicznik) {
  16.             maxwartosc=wartosc;
  17.             maxlicznik=licznik;
  18.         }
  19.     }
  20.     return maxwartosc;
  21. }
  22.  
  23. int main() {
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement