第五次

/**
* @param args
*/
public static void main(String[] args) {
int a=100;
int ge,shi,bai;
for(;a<1000;a++){
ge=a%10;
shi=a/10%10;
bai=a/100;
if(ge*ge*ge+shi*shi*shi+bai*bai*bai==a){
System.out.println(a);
}
}
}
}

 

 

/**
* @param args
*/
public static void main(String[] args) {
int i;
int sum=0;
for(i=1;i<=100;i++){
if(i%3!=0){
continue;
}
sum=sum+i;
}
System.out.println("能被3整除的整数和为"+sum);
}

/**
* @param args
*/
public static void main(String[] args) {
int i=1;
int sum=0;
while(i<=100){
if(i%3==0){
sum+=i;
}
i++;
}
System.out.println(sum);

}
}


}

 

 

/**
* @param args
*/
public static void main(String[] args) {
System.out.println("输入年月日");
Scanner input=new Scanner(System.in);
int year=input.nextInt();
int month=input.nextInt();
int day=input.nextInt();
int countday=0;
for(int i=1;i<mouth;i++){
if(month==1||month==3||month==5||month==7||month==8||month==10||month==12){
countday+=31;
}else if(month==4||month==6||month==9||month==11){
countday+=30;
}else if(month==2){
if(year%4==0&&year%100!=0||year%400==0){
countday+=29;
}else{
countday+=28;
}
}
}
countday+=day;
System.out.println("今天是"+year+"中的第"+countday+"天");
}
}

 

 

/**
* @param args
*/
public static void main(String[] args) {
int i;
for(i=1;i<9;i++){
if(i==5){
continue;
}
System.out.println("0至9之间的数为"+i);
}
}

 

 


}

/**
* @param args
*/
public static void main(String[] args) {
System.out.println("输一个四位数");
Scanner input=new Scanner(System.in);
int num=input.nextInt();
int lerp=1000;
int value=0;
for(int i=1;i<=4;i++){
value=value+(num%10*lerp);
lerp/=10;
num/=10;
}
System.out.println("反转后为"+value);
}
}

 

 

/**
* @param args
*/
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
int i=input.nextInt();
int a;
int jie=1;
for(a=1;a<=i;a++){
jie=jie*a;
}
System.out.println("阶乘为"+jie);

}
}

 

 

/**
* @param args
*/
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
int gread=input.nextInt();
for(;gread<0||gread>100;){
System.out.println("输入错误请重新输入");
gread=input.nextInt();
}
System.out.println("成绩为"+gread);
}
}

 

 

* @param args
*/
public static void main(String[] args) {
int a=30000;
int year;
double b=0.06;
int sum=0;
for(year=1;year<=10;year++){
a=(int)(a+a*b);
sum=(int)(sum+a);
}
System.out.println("十年后收入"+sum);
}
}

 

posted @ 2021-04-07 08:28  Endofibrin  阅读(36)  评论(0编辑  收藏  举报