Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int numbers(int n) {
  4. if (n / 10 == 0) {
  5. return 1;
  6. }
  7. return 1 + numbers(n / 10);
  8. }
  9. int main() {
  10. long int n, flag_2 = 0, flag_5 = 0;
  11. cin >> n;
  12. while (n > 0) {
  13. if (n % 10 == 2 && flag_2 == 0) {
  14. flag_2 = 1;
  15. }
  16. if (n % 10 == 5 && flag_5 == 0) {
  17. flag_5 = 1;
  18. }
  19. n = n / 10;
  20. }
  21. if (flag_2 == 1 && flag_5 == 1) {
  22. cout << "YES";
  23. }
  24. else {
  25. cout << "NO";
  26. }
  27. system("pause");
  28. return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement