Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. public static int analizaLiczby (int liczba, String cyfry) {
  2. String cyfryArr[] = String.valueOf(cyfry).split("");
  3. int ileCyfr = cyfry.length();
  4. int ilosc = 0;
  5. int liczba1 = liczba;
  6. for (int i=0; i<ileCyfr ; i++) {
  7. liczba = liczba1;
  8. String cyfra = cyfryArr[i];
  9. while (liczba/10 != 0) {
  10. if (liczba % 10 == Integer.parseInt(cyfra))
  11. ilosc += 1;
  12.  
  13. liczba /= 10;
  14.  
  15. }
  16.  
  17. if (liczba == Integer.parseInt(cyfra))
  18. ilosc += 1;
  19.  
  20.  
  21. }
  22. return ilosc;
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement