学习Java的第九天 | 您所在的位置:网站首页 › 五位回文数有多少个 › 学习Java的第九天 |
1.打印5位数中的所有回文数,每行打印10个数。最后统计一下一共有多少个5位回文数。
public class test1 {
public static void main(String[] args) {
// 、打印5位数中的所有回文数,每行打印10个数。最后统计一下一共有多少个5位回文数。
int k=0;
for (int i=10000;i=90)
System.out.println("优秀");
else if (i=80)
System.out.println("良好");
else if (i=70)
System.out.println("中等");
else if (i=60)
System.out.println("及格");
else
System.out.println("不及格");
}
}
4.输出杨辉三角形,要求,根据键盘录入的行数,决定等腰三角形的行数。 5. public class test4 { public static void main(String[] args) { //输出杨辉三角形,要求,根据键盘录入的行数,决定等腰三角形的行数。 Scanner sc=new Scanner(System.in); System.out.println("请输入行数"); int i=0; while (true){ i= sc.nextInt(); if (i b=sc.nextInt(); if(b>=1 && b if (a == b && b == c) { System.out.println("等边三角形"); } else if (a == b || b == c || a == c) { System.out.println("等腰三角形"); } else if (a * a + b * b == c * c || a * a + c * c == b * b || b * b + c * c == a * a) { System.out.println("直角三角形"); } else System.out.println("普通三角型"); } else { System.out.println("不是三角型"); } } } |
CopyRight 2018-2019 实验室设备网 版权所有 |