Advertisement
Flaron

Udemy_18.hasSharedDigit

Sep 14th, 2019
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. package lista.Alapok;
  2.  
  3. public class Main {
  4.  
  5. public static boolean hasSharedDigit(int a, int b) {
  6. if((a<10 || a>99) || (b<10 || b>99)) return false;
  7. if ((a%10==b%10) || (a/10==b/10) || (a%10==b/10) || (a/10==b%10)) return true;
  8. else return false;
  9. }
  10.  
  11. public static void main(String[] args) {
  12. System.out.println(hasSharedDigit(21, 32));
  13. }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement