跪求一个java简单题答案 本帖最后由 zxmzaofan 于 2010-11-03 15:23:43 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 System.out.print("请输入行数(3-21):"); Scanner input = new Scanner(System.in); int row = input.nextInt(); if (row >=3 && row <=21) { for (int i = 0; i < row; i++) { for (int j = 0; j < i; j++) { System.out.print(" "); } for (int k = 0; k < (row-i)*2-1; k++) { System.out.print("*"); } System.out.println(); } } else { System.out.println("非法行数!"); } 初学者问各位大侠一个超级简单的问题,为什么这个程序会得出5151? Out of Memory 异常 如何获取当前时间的后一天? java如何用正则表达式获取一对标签的内容 如何设置java环境变量 除了socket类,java还有其他网络通信类吗? 求助:javax.comm.* installanywhere做已有安装程序的升级包 请问Java中字体的高度如何取得? 用applet传图像给servlet 该怎样做? java通过代理验证,访问外网 netbeans可视化界面设计
System.out.print("请输入行数(3-21):");
Scanner input = new Scanner(System.in);
int row = input.nextInt();
if (row >=3 && row <=21) {
for (int i = 0; i < row; i++) {
for (int j = 0; j < i; j++) {
System.out.print(" ");
}
for (int k = 0; k < (row-i)*2-1; k++) {
System.out.print("*");
}
System.out.println();
}
} else {
System.out.println("非法行数!");
}