(1):打印等腰三角形:
*
* *
* * *
* * * *
* * * * *
package LianXi;
import java.util.Scanner;
public class lianxi {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("请输入要打印的层数:");
int layer = scanner.nextInt();
for (int i = 1; i <= layer; i++){
for (int j = 1; j <= layer - i; j++){
System.out.print(" ");
}
for (int j = 1; j <= i; j++){
System.out.print("*" + " ");
}
System.out.println();
}
}
}
(2):请在控制台上输入两个数,并且输入一个符号(+ - / *),使用switch语句:
package LianXi;
import java.util