作业

//public class FiveBreak {//作业1
// public static void main(String[] args) {
// int times = 0;
// double money = 100000;
// while (money > 50000 ){
// money = (money - (money * 0.05));
// times++;
// }
// while (money <= 50000){
// money -= 1000;
// times++;
// if(money <= 0){
// break;
// }
// }
// System.out.println(times);
// }
//}
//import java.util.Scanner;
//public class FiveBreak {//作业2
// public static void main(String[] args) {
// Scanner myScanner = new Scanner(System.in);
// System.out.println("请输入一个整数");
// int z = myScanner.nextInt();
// if(z > 0){
// System.out.println("整数大于零");
//
// }else if(z == 0){
// System.out.println("整数等于零");
// }else {
// System.out.println("整数大于零");
// }
// }
//}
//import java.util.Scanner;
//public class FiveBreak {//作业3 闰年能被4整除 但不能被100整除 或者能被400整除
// public static void main(String[] args) {
// Scanner myScanner = new Scanner(System.in);
// int year = myScanner.nextInt();
// if( (year % 4 == 0 && year % 100 != 0) || year % 400 == 0 ){
// System.out.println("这一年是闰年");
// }else {
// System.out.println("这一年是平年");
// }
// }
//}
import java.util.Scanner;
public class FiveBreak {//作业4
public static void main(String[] args) {
int fn = 407;
int fn_store100 = 0;
int single = 0;
int ten = 0;
int h = fn;
for (; fn <= 999;fn--){
if(fn % 10 == 0){
break;
}
single++;
}

while (fn <= 999 ){
if (fn % 100 == 0){
break;
}
fn -= 10;
ten += 10;

}
while (fn <= 999){
if ((fn + 1) / 1 == 1){
break;
}
fn -= 100;
fn_store100 += 100;

}
ten = ten / 10;
fn_store100 = fn_store100 / 100;
System.out.println(fn_store100 + " " + ten + " " + single );
if (h == fn_store100 * fn_store100 * fn_store100 + ten * ten * ten + single * single *single ){
System.out.println(h + "是一个水仙花数");
}
}
}
posted @ 2021-12-09 15:05  MortyJT  阅读(22)  评论(0)    收藏  举报