java之控制语句例
2021-01-15 00:13
标签:system 合数 ring break sum str += sys dial 不是精简的 /*判断是否闰年 求和 阶乘 合数 素数 菱形 倒正数*/ import javax.swing.JOptionPane; public class Zuo { public static void main(String[] args) { // int b=Integer.parseInt(a); } else if (b % 4 == 0) { int a = 9, sum1 = 1;String r=""; int he = 0, He, ji = 0; for (int j = 2; j if (i % j == 0) { } int su = 2, o, geshu = 0; int w = i % j; } public class Fx { public static void main(String[] args) { System.out.print(" "); for (int j = 0; j
if (j == i || j == 0) { System.out.print("*"); } } System.out.print("*"); } } for (int j = 0; j System.out.print(" " + j); } } } java之控制语句例 标签:system 合数 ring break sum str += sys dial 原文地址:https://www.cnblogs.com/jinjinqiao/p/12939684.html
// String a=JOptionPane.showInputDialog("请输入年份:");
int b = 3231;
if (b % 100 == 0) {
if (b % 400 == 0) {
System.out.println("是闰年");
} else {
System.out.println("不是闰年");
}
System.out.println("是闰年");
} else {
System.out.println("不是闰年");
}
if (b % 4 == 0 && b % 100 != 0 || b % 400 == 0) {
System.out.println("是闰年");
} else {
System.out.println("不是闰年");
}
int sum = 0;
for (int i = 1; i sum += i;
}
System.out.println("1+2+...+100=" + sum);
for (int i = 1; i sum1 *= i;
}
System.out.println("a!=" + sum1);
for (int i = 1; i
he = i;
break;
}
if (he != 0) {
He = he + 1;
if (He - 1 == i) {
r+= he+" ";
ji += 1;
}
}
continue;
}
System.out.println(ji+"个");
System.out.println("合数:"+r);
String l = "";
for (int i = 1; i o = 0;
for (int j = 2; j
if (w == 0) {
o += 1;
break;
}
}
if (o == 0) {
su = i;
}
// Su = su + 1;
// if (Su - 1 == i && i != 1) {
if (su == i && i != 1) {
l += su + " ";
geshu += 1;
}
}
System.out.println(geshu+"个");
System.out.println("素数:" + l);
}
for (int i = 0; i System.out.println();
int num = 10;
for (int j = 0; j
num -= 1;
}
} else {
System.out.print(" ");
}
for (int i = 10; i >= 0; i -= 2) {
System.out.println();
int num = 10;
for (int j = 0; j System.out.print(" ");
num -= 1;
}
for (int j = 0; j if (j == i || j == 0) {
} else {
System.out.print(" ");
}
System.out.println();
for (int i = 0; i if (i % 2 == 0) {
}
} else {
for (int j = 10; j >= 1; j--) {
System.out.print(" " + j);
}
}
System.out.println();
上一篇:C++ 创建进程的方法