Advertisement
a53

zero_unu

a53
Oct 29th, 2021
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int n, c, nr0, nr1;
  6. cin >> n;
  7. nr0 = nr1 = 0;
  8. while (n > 0 && n % 10 <= 1)
  9. {
  10. c = n % 10;
  11. if (c == 0) nr0++;
  12. else nr1++;
  13. n /= 10;
  14. }
  15. if (n == 0 && nr0 > 0 && nr1 > 0)
  16. cout << "da";
  17. else cout << "nu";
  18. return 0;
  19. }
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement