PiotrJurek

Zad25

Mar 30th, 2020
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int WYSTAPIENIA(int n, int c)
  6. {
  7. int x=0, y;
  8. for(n; n>0; n=n/10)
  9. {
  10. y=n%10;
  11. if(y==c)
  12. {
  13. x++;
  14. }
  15. }
  16. return x;
  17. }
  18.  
  19. int main()
  20. {
  21. cout << WYSTAPIENIA(1679236, 6) << endl;
  22. cout << WYSTAPIENIA(209009, 0) << endl;
  23. cout << WYSTAPIENIA(77776777, 7) << endl;
  24. return 0;
  25. }
Add Comment
Please, Sign In to add comment