使用forloop-** u,t,o,n,z,x,e,f,h,k,m,y,w,w,p,q,r **
时间:2025-02-16
浏览:112
作者:佚名
小伙伴们对文章编程感兴趣吗?是否正在学习相关知识点?如果是,那么本文《使用forloop-** u,t,o,n,z,x,e,f,h,k,m,y,w,w,p,q,r **》,就很适合你,本篇文章讲解的知识点主要包括。在之后的文章中也会多多分享相关知识点,希望对大家的知识积累有所帮助!
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 **》的内容了。个人认为,基础知识的学习和巩固,是为了更好的将其运用到项目中,欢迎关注golang学习网公众号,带你了解更多关于的知识点!
本文内容来源于互联网,如有侵权请联系删除。
近期热门
11.18
11.15
站内热门
最新文章
11.20
11.20
11.20
11.20
热门专题
