利用条件运算符的嵌套来完成此题:学习成绩>=90分的同学用A表示,60-89分之间的用B表示,60分以下的用C表示。 public class Example05 { public static void main(String[] args) { score(90); } public stati Read More
posted @ 2017-05-31 15:50
本宫在,尔等都是妃
Views(152)
Comments(0)
Diggs(0)
将一个正整数分解质因数。例如:输入90,打印出90=2*3*3*5。 public class Example04 { public static void main(String[] args) { f(100); } public static void f(int n) { int k = 2 Read More
posted @ 2017-05-31 15:47
本宫在,尔等都是妃
Views(199)
Comments(0)
Diggs(0)
打印出所有的"水仙花数",所谓"水仙花数"是指一个三位数,其各位数字立方和等于该数本身。例如:153是一个"水仙花数",因为153=1的三次方+5的三次方+3的三次方。 public class Example03 { public static void main(String[] args) { Read More
posted @ 2017-05-31 15:38
本宫在,尔等都是妃
Views(288)
Comments(0)
Diggs(0)
判断101-200之间有多少个素数,并输出所有素数。 public class Example02 { public static void main(String[] args) { prime(); } public static void prime() { int count = 0; fo Read More
posted @ 2017-05-31 15:36
本宫在,尔等都是妃
Views(228)
Comments(0)
Diggs(0)
有一对兔子,从出生后第3个月起每个月都生一对兔子,小兔子长到第四个月后每个月又生一对兔子,假如兔子都不死,问每个月的兔子总数为多少? public class Example01 { public static void main(String[] args) { int a = 8; int su Read More
posted @ 2017-05-31 15:34
本宫在,尔等都是妃
Views(324)
Comments(0)
Diggs(0)

浙公网安备 33010602011771号