package org.other;import java.util.Scanner;/* * 题目:打印常用图形逻辑 */public class Ninthninth {public static void main(String[] args) {holl_Triangle(10); }private static void holl_Triangle(int num){ for (int i = 0; i < num; i++) {if (i!=num-1) {for (int j = 0; j < 2*num-1; j++) {if (j==num+i-1||j==num-i-1) {System.out.print("*");} else {System.out.print(" ");}}} else {for (int j = 0; j < 2*num-1; j++) {System.out.print("*");}}System.out.println();}}private static void M8() {// 打印平行四边形for (int i = 0; i < 10; i++) {for (int j = 10; j > i; j--) {System.out.print(" ");}for (int j = 0; j < 2 * i + 1; j++) {System.out.print("*");}for (int j = 22; j > 2 * i + 1; j--) {System.out.print("*");}System.out.println();}}private static void M7() {// 打印空心正方形Scanner sc = new Scanner(System.in);System.out.println("请输入的你要打印的大小!");int num = sc.nextInt();for (int x = 0; x < num; x++) {for (int y = 0; y < num; y++) {// x=0 y=0 控制上下两条线// num-1=x num-1=y 控制左右两条线if (x == 0 || y == 0 || num - 1 == x || num - 1 == y) {System.out.print("*");} else {System.out.print(" ");}}System.out.println();}}private static void M6() {// 打印菱型// 上部分for (int i = 0; i < 10; i++) {for (int j = 10; j > i; j--) {System.out.print(" ");}for (int j = 0; j < 2 * i + 1; j++) {System.out.print("*");}System.out.println();} // 下部分for (int i = 0; i < 10; i++) {for (int j = 0; j < i; j++) {System.out.print(" ");}for (int j = 22; j > i * 2 + 1; j--) {System.out.print("*");}System.out.println();}}private static void M5() {// 等腰三角形for (int i = 0; i < 9; i++) {for (int j = 9; j > i; j--) {System.out.print(" ");}for (int j2 = 0; j2 < 2 * i + 1; j2++) {System.out.print("*");}System.out.println();}}private static void M4() {// 倒三角for (int i = 0; i < 9; i++) {for (int j = 9; j > i; j--) {System.out.print("*");}System.out.println();}}private static void M3() {// 三角形for (int i = 0; i < 10; i++) {for (int j = 0; j < i; j++) {System.out.print("*");}System.out.println();}}private static void M2() {// 下三角for (int i = 0; i <= 9; i++) {for (int j = 0; j <= i; j++) {System.out.println(j + "*" + i + "=" + j * i);}System.out.println();}}private static void M1() {// 矩阵三角for (int i = 0; i < 9; i++) {for (int j = 0; j < 9; j++) {}System.out.println();}}}