u,t,t,o,n,z,x,e,f,h,k,m,y,w,p,p,q,r
package Afterfeb4; public class forlooppattern1 { public static void main(String[] args) { // findstar(); // findU(); // findT(); // finfO(); // findN(); // findZ(); // findX(); // findparttenE(); // findparttenF(); // findparttenH(); // findparttenK(); // findpartternM(); // findpartternY(); // findpartternW(); // findpartterP(); // findpartternQ(); findpartternR(); } private static void findpartternR() { for (int row = 1; row <= 9; row++) { for (int col = 1; col <= 9; col++) { if (col == 1 || row == 1 && col <= 5 || col == 5 && row <= 5 || row == 5 && col <= 5 || row - col == 5) System.out.print("* "); else System.out.print(" "); } System.out.println(); } } private static void findpartternQ() { for (int row = 1; row <= 9; row++) // --- { for (int col = 1; col <= 9; col++)// || { if (col == 1 && row <= 7 || col == 7 && row <= 7 || row == 1 && col <= 7 || row == 7 && col <= 7 || col == row && row > 3) System.out.print("* "); else System.out.print(" "); } System.out.println(); } } private static void findpartterP() { for (int row = 1; row <= 9; row++) { for (int col = 1; col <= 9; col++) { if (col == 1 || row == 1 || col == 9 && (row <= 5) || row == 5) System.out.print("* "); else System.out.print(" "); } System.out.println(); } } private static void findpartternW() { for (int row = 1; row <= 9; row++) { for (int col = 1; col <= 9; col++) { if (col == 1 || col == 9 || col + row == 10 && (row >= 5) || col == row && (row >= 5)) System.out.print("* "); else System.out.print(" "); } System.out.println(); } } private static void findpartternY() { for (int row = 1; row <= 9; row++) { for (int col = 1; col <= 9; col++) { if (col + row == 10 && (row <= 5) || col == row && (row <= 5) || col == 5 && (row >= 5)) System.out.print("* "); else System.out.print(" "); } System.out.println(); } } private static void findpartternM() { for (int row = 1; row <= 9; row++) { for (int col = 1; col <= 9; col++) { if (col == 1 || col == 9 || col + row == 10 && (row <= 5) || col == row && (row <= 5)) System.out.print("* "); else System.out.print(" "); } System.out.println(); } } private static void findparttenK() { for (int row = 1; row <= 9; row++) { for (int col = 1; col <= 9; col++) { if (row + col == 4 || row - col == 2 || col == 1) System.out.print("* "); else System.out.print(" "); } System.out.println(); } } private static void findparttenH() { for (int row = 1; row <= 9; row++) { for (int col = 1; col <= 9; col++) { if (row == 5 || col == 9 || col == 1) System.out.print("* "); else System.out.print(" "); } System.out.println(); } } private static void findparttenF() { for (int row = 1; row <= 9; row++) { for (int col = 1; col <= 9; col++) { if (row == 1 || row == 5 || col == 1) System.out.print("* "); else System.out.print(" "); } System.out.println(); } } private static void findparttenE() { for (int row = 1; row <= 9; row++) { for (int col = 1; col <= 9; col++) { if (row == 1 || row == 5 || row == 9 || col == 1) System.out.print("* "); else System.out.print(" "); } System.out.println(); } } private static void findX() { for (int row = 1; row <= 9; row++) { for (int col = 1; col <= 9; col++) { if (col + row == 10 || col == row) System.out.print("* "); else System.out.print(" "); } System.out.println(); } } private static void findZ() { for (int row = 1; row <= 9; row++) { for (int col = 1; col <= 9; col++) { if (row + col == 10 || row == 1 || row == 9) System.out.print("* "); else System.out.print(" "); } System.out.println(); } } private static void findN() { for (int row = 1; row <= 9; row++) { for (int col = 1; col <= 9; col++) { if (row == col || col == 1 || col == 9) System.out.print("* "); else System.out.print(" "); } System.out.println(); } } private static void finfO() { for (int row = 1; row <= 9; row++) { for (int col = 1; col <= 9; col++) { if (row == 1 || row == 9 || col == 1 || col == 9) System.out.print("* "); else System.out.print(" "); } System.out.println(); } } private static void findT() { for (int row = 1; row <= 9; row++) { for (int col = 1; col <= 9; col++) { if (row == 1 || col == 5) System.out.print("* "); else { System.out.print(" "); } } System.out.println(); } } private static void findU() { for (int row = 1; row <= 9; row++)// --- { for (int col = 1; col <= 9; col++) { if (col == 1 || col == 9 || row == 9)// || col System.out.print("* "); else System.out.print(" "); } System.out.println(); } } private static void findstar() { for (int row = 1; row <= 9; row++) { for (int col = 1; col <= 9; col++) { System.out.print("* "); } System.out.println(" "); } } }
以上就是使用forloop-** u,t,o,n,z,x,e,f,h,k,m,y,w,w,p,q,r **的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号