输出直角三角形 java
public class testone {
public static void main(String[] args) {
// 打印多行内容 假设打印line_num行
int line_num = 9;
for (int i = 1; i <= line_num; i++) {
int n = 6;
// 想让第一行输出一个符号,第二行输出二个符号
for (int j = 0; j < i; j++) {
System.out.print("*");
}
System.out.println();
}
}
}
"C:\Program Files\Java\jdk1.7.0_17\bin\java.exe" "-javaagent:D:\Program Files\JetBrains\IntelliJ IDEA Educational Edition 2020.2\lib\idea_rt.jar=53167:D:\Program Files\JetBrains\IntelliJ IDEA Educational Edition 2020.2\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.7.0_17\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.7.0_17\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.7.0_17\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.7.0_17\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.7.0_17\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.7.0_17\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.7.0_17\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.7.0_17\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.7.0_17\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.7.0_17\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.7.0_17\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.7.0_17\jre\lib\jce.jar;C:\Program Files\Java\jdk1.7.0_17\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.7.0_17\jre\lib\jfxrt.jar;C:\Program Files\Java\jdk1.7.0_17\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.7.0_17\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.7.0_17\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.7.0_17\jre\lib\resources.jar;C:\Program Files\Java\jdk1.7.0_17\jre\lib\rt.jar;C:\Users\Administrator\IdeaProjects\untitled\out\production\untitled" testone
*
**
***
****
*****
******
*******
********
*********
Process finished with exit code 0