java题目 高分求助紧急

1.i=5j=-3 2.4 3.2 4.int: 8 double: 8.0 5.Not Equal 6.SubClass: 200 SuperClass: 100 7.import java.util.Scanner;public class TestMath { public static void main(String[] args) { double sum = 1;Scanner sc = new Scanner(System.in);int num = sc.nextInt();int i ...
java题目 高分求助紧急
1.i=5j=-3
2.4
3.2
4.int: 8
double: 8.0
5.Not Equal
6.SubClass: 200
SuperClass: 100
7.import java.util.Scanner;
public class TestMath {
public static void main(String[] args) {
double sum = 1;
Scanner sc = new Scanner(System.in);
int num = sc.nextInt();
int i = 1;
while (i <= num) {
sum *= count(i);
i++;
}
System.out.println(sum);
}

static double count(int i) {
return Math.pow(2, i);
}
}
8.extends,super.test()
9.i=0
10. The value is 2
The value is 32009-06-20
1: 输出结果 i=5j=-3
2: 输出结果 4
3:输出结果 3
4:输出结果
int: 8
double: 8.0
5:输出结果 Not Equal
6:输出结果
SubClass: 200
SuperClass: 100

7 :public class TestSum{
public long sum(int number){
long s=1;
long k=1;;
for(long i=2;i<=number;i++){

if(i%k==0){
s*=i;
k=i;
}
}
return s;
}
public static void main(String[] args){
System.out.println(new TestSum().sum(12));
}

}

8:extends ,super.test()
9: 输出结果 i = 0
10: 输出结果
The value is 2
The value is 32009-06-20
mengvlog 阅读 8 次 更新于 2025-07-19 04:17:15 我来答关注问题0
檬味博客在线解答立即免费咨询

Java相关话题

Copyright © 2023 WWW.MENGVLOG.COM - 檬味博客
返回顶部