Lucian_Adrian

#3104 B_Egal

Feb 12th, 2022
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. int Egal(int n)
  2. {
  3. int r = -1, x = n;
  4. while(x)
  5. {
  6. if(x % 2 == 1)
  7. r = x % 10;
  8. x /= 10;
  9. }
  10. while(n)
  11. {
  12. if(n % 2 == 1 && n % 10 != r)
  13. return 0;
  14. n /= 10;
  15. }
  16. return 1;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment