porteno

Q2

Dec 7th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. public class Q2 {
  2. public static void main(String[] args) {
  3. System.out.println(secret1(937, 5));
  4.  
  5. }
  6.  
  7. public static boolean secret1(int num, int digit) {
  8. if(num<10)
  9. return (num%2 == digit%2);
  10. if(num%2 != digit%2)
  11. return false;
  12. return secret1(num/10, digit);
  13. }
  14. }
Add Comment
Please, Sign In to add comment