Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class projekt2{
- public static boolean isPalindrome(int number) {
- int palindrome = number;
- int reverse = 0;
- while (palindrome != 0) {
- int remainder = palindrome % 10;
- reverse = reverse * 10 + remainder;
- palindrome = palindrome / 10;
- }
- if (number == reverse) {
- return true;
- }
- return false;
- }
- public static int Problem4(){
- int pp = 0;
- int a = 0;
- for (int i=100;i<1000;i++){
- for (int j=100;j<1000;j++){
- pp = i*j;
- if(isPalindrome(pp))
- if(pp>a) a = pp;
- }
- }
- return(a);
- }
- public static void main(String[] args) {
- System.out.println(Problem4());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement