一球从100米高度自由落下,每次落地后反跳回原高度的一半;再落下……求它在第10次落地时,共经过多少米?第10次反弹多高? public class Example10 { public static void main(String[] args) { height(); } public sta Read More
posted @ 2017-06-01 11:38 本宫在,尔等都是妃 Views(477) Comments(2) Diggs(0) Edit
一个数如果恰好等于它的因子之和,这个数就称为"完数"。例如6=1+2+3。编程找出1000以内的所有完数。 public class Example09 { public static void main(String[] args) { number(); } public static void Read More
posted @ 2017-06-01 11:37 本宫在,尔等都是妃 Views(219) Comments(0) Diggs(0) Edit
求s=a+aa+aaa+aaaa+aa...a的值,其中a是一个数字。例如2+22+222+2222+22222(此时共有5个数相加),几个数相加由键盘控制。 public class Example08 { public static void main(String[] args) { sum( Read More
posted @ 2017-06-01 11:36 本宫在,尔等都是妃 Views(171) Comments(0) Diggs(0) Edit
输入一行字符,分别统计出其中英文字母、空格、数字和其它字符的个数。 public class Example07 { public static void main(String[] args) { String s = "Hello World! BeiJing AoYun 2008。"; num Read More
posted @ 2017-06-01 11:35 本宫在,尔等都是妃 Views(180) Comments(0) Diggs(0) Edit
输入两个正整数m和n,求其最大公约数和最小公倍数。 public class Example06 { public static void main(String[] args) { int a = 1; int b = 10; int max = f(a, b); int min = a * b Read More
posted @ 2017-06-01 11:34 本宫在,尔等都是妃 Views(233) Comments(1) Diggs(0) Edit