Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package lista.Alapok;
- public class Main {
- public static boolean hasSameLastDigit(int a, int b, int c) {
- if((a<10 || a>1000) || (b<10 || b>1000) ||(c<10 || c>1000)) return false;
- if ((a%10==b%10) || (a%10==c%10) || (b%10==c%10)) return true;
- else return false;
- }
- public static boolean isValid(int number) {
- while(number<10 || number>1000) return false;
- return true;
- }
- public static void main(String[] args) {
- System.out.println(hasSameLastDigit(22, 33, 232));
- System.out.println(isValid(1230));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement