資源簡介
水仙花數(shù) 它的每個(gè)位上的數(shù)字的n次冪之和等于它本身。
位數(shù):3
輸出:153,370,371,407
位數(shù):5
輸出:54748,92727,93084
代碼片段和文件信息
package?fd.zc;
import?java.util.Scanner;
public?class?Flower?{
public?static?void?main(String[]?args)?{
// System.out.println(getLength(12344));
// System.out.println(isFlowerNum(153));
// System.out.println(isFlowerNum(154));
????Flower?f=new?Flower();
f.getFlowerNum();
}
public?void?getFlowerNum()
{
System.out.println(“input?a?number“);
Scanner?sc=new?Scanner(System.in);
int?size=sc.nextInt();
int?beginend;
begin=(int)?Math.pow(10?size-1);
end=(int)?((Mat
評(píng)論
共有 條評(píng)論