JAVA
文章平均质量分 58
star丶
记录
展开
-
label、break、continue
public class TestLable { public static void main(String[] args) { int i = 0; outer: for (; true;) { inner: for (; i < 10; i++) { System.out.println("i=" + i); if (i == 2) {原创 2016-09-21 20:04:47 · 221 阅读 · 0 评论 -
输出指定长度的斐波那契数列
输出指定长度的斐波那契数列 import java.util.Scanner; public class Fbonacci { // 递归做法 static int fib(int n) { if (n == 1) { return 1; } if (n == 2) { return 1; } else { n--; return fib(n) +原创 2016-09-21 21:02:44 · 1283 阅读 · 0 评论 -
吸血鬼数
吸血鬼数字是指位数为偶数的数字,可以由一对数字相乘而得到,而这对数字各包含乘积的一半位数的数字,其中从最初的数字中选取的数字可以任意排序。以两个0结尾的数字是不允许的。编程找出所有的4位数的吸血鬼数字。 public class VampireNumbers { public static void main(String[] args) { int sum = 0; int[]原创 2016-09-22 10:37:45 · 235 阅读 · 0 评论