0

0

使用forloop-** u,t,o,n,z,x,e,f,h,k,m,y,w,w,p,q,r **

霞舞

霞舞

发布时间:2025-02-15 14:40:29

|

548人浏览过

|

来源于dev.to

转载

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("  ");
        }

    }

}


相关专题

更多
PHP 表单处理与文件上传安全实战
PHP 表单处理与文件上传安全实战

本专题聚焦 PHP 在表单处理与文件上传场景中的实战与安全问题,系统讲解表单数据获取与校验、XSS 与 CSRF 防护、文件类型与大小限制、上传目录安全配置、恶意文件识别以及常见安全漏洞的防范策略。通过贴近真实业务的案例,帮助学习者掌握 安全、规范地处理用户输入与文件上传的完整开发流程。

5

2026.01.13

PPT交互图表教程大全
PPT交互图表教程大全

本专题整合了PPT交互图表相关教程汇总,阅读专题下面的文章了解更多详细内容。

49

2026.01.12

Java 项目构建与依赖管理(Maven / Gradle)
Java 项目构建与依赖管理(Maven / Gradle)

本专题系统讲解 Java 项目构建与依赖管理的完整体系,重点覆盖 Maven 与 Gradle 的核心概念、项目生命周期、依赖冲突解决、多模块项目管理、构建加速与版本发布规范。通过真实项目结构示例,帮助学习者掌握 从零搭建、维护到发布 Java 工程的标准化流程,提升在实际团队开发中的工程能力与协作效率。

20

2026.01.12

c++主流开发框架汇总
c++主流开发框架汇总

本专题整合了c++开发框架推荐,阅读专题下面的文章了解更多详细内容。

135

2026.01.09

c++框架学习教程汇总
c++框架学习教程汇总

本专题整合了c++框架学习教程汇总,阅读专题下面的文章了解更多详细内容。

66

2026.01.09

学python好用的网站推荐
学python好用的网站推荐

本专题整合了python学习教程汇总,阅读专题下面的文章了解更多详细内容。

140

2026.01.09

学python网站汇总
学python网站汇总

本专题整合了学python网站汇总,阅读专题下面的文章了解更多详细内容。

13

2026.01.09

python学习网站
python学习网站

本专题整合了python学习相关推荐汇总,阅读专题下面的文章了解更多详细内容。

19

2026.01.09

俄罗斯手机浏览器地址汇总
俄罗斯手机浏览器地址汇总

汇总俄罗斯Yandex手机浏览器官方网址入口,涵盖国际版与俄语版,适配移动端访问,一键直达搜索、地图、新闻等核心服务。

106

2026.01.09

热门下载

更多
网站特效
/
网站源码
/
网站素材
/
前端模板

精品课程

更多
相关推荐
/
热门推荐
/
最新课程
10分钟--Midjourney创作自己的漫画
10分钟--Midjourney创作自己的漫画

共1课时 | 0.1万人学习

Midjourney 关键词系列整合
Midjourney 关键词系列整合

共13课时 | 0.9万人学习

AI绘画教程
AI绘画教程

共2课时 | 0.2万人学习

关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送

Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号