Advertisement
medajibka

3.6

Apr 18th, 2022
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. long a;
  6.  
  7. void input() {
  8. cout << "Enter a: ";
  9. cin >> a;
  10. }
  11.  
  12. int countZeroes(long num) {
  13. int count = 0;
  14. while (num != 0) {
  15. if (num % 10 == 0) {
  16. count++;
  17. }
  18. num /= 10;
  19. }
  20. return count;
  21. }
  22.  
  23. int main() {
  24.  
  25. input();
  26.  
  27. cout << "Result: " << countZeroes(a) << endl;
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement