ywfp

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
import java.util.*;
public class Main {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        for(int i=a; i<=b; i++)
        {
            if (i >= 3)
            {
                String m = "";
                int k = 2;
                int j = i;
                while (j != k) 
                {
                    if (j % k == 0) 
                    {
                        m = m + k + "*";
                        j = j / k;
                    }
                    else if (j % k != 0) 
                    {
                        k++;
                    }
                }
                m = m + k;
                System.out.println(i + "=" + m);
            }
            else 
            {
                System.out.println(i + "=" + i);
            }
        }
    }
}

转载:https://blog.csdn.net/m0_38046610/article/details/79660480

posted on 2020-03-15 15:47  ywfp  阅读(811)  评论(0编辑  收藏  举报