Find the largest palindrome made from the product of two 3-digit numbers

前端 未结 17 992
天涯浪人
天涯浪人 2021-02-02 04:27
package testing.project;

public class PalindromeThreeDigits {

    public static void main(String[] args) {
        int value = 0;
        for(int i = 100;i <=999;i+         


        
17条回答
  •  一向
    一向 (楼主)
    2021-02-02 05:20

    public class Pin
    {
        public static boolean isPalin(int num)
        {
            char[] val = (""+num).toCharArray();
            for(int i=0;i100;i--)
                for(int j=999;j>100;j--)
                {
                    int mul = j*i;
                    if(isPalin(mul))
                    {
                        System.out.printf("%d * %d = %d",i,j,mul);
                        return;
                    }
                }
        }
    }
    

提交回复
热议问题