标签:blog 求质数 ++ rgs == system void logs his
public class A { public static void main(String[] args) { } // 求质数 100以内的 public static void zhishu() { for (int j = 1; j < 100; j++) { int i = 0; for (int j2 = 1; j2 <= j; j2++) { if (j % j2 == 0) { i++; } } if (i == 2) { System.out.println(j + ","); } } } // 求阶乘 public void jiecheng() { int a = 3; int b = 1; /* * for (a = 3; a > 0; a--) { b = b * a; } */ while (a > 0) { b = b * a; a--; } System.out.println(b); A.zhishu(); } }
标签:blog 求质数 ++ rgs == system void logs his
原文地址:http://www.cnblogs.com/HHR-SUN/p/6955222.html