当前位置:网站首页>10day
10day
2022-07-20 10:53:00 【denggongming】
Java practice : Print various drawings ( an isosceles triangle , right triangle , Solid diamond , Hollow diamond )
1. an isosceles triangle
Code :
Print screenshots :
2. right triangle
Code :
Print screenshots :
3. Solid diamond
analysis : Here we can see the diamond as two isosceles triangles , It can be disassembled to print an upright triangle , An inverted triangle . Because there can only be one diagonal in the middle , So either the number of rows of upright triangle stars is one row less than the number of rows of inverted triangle stars , Or the number of rows of inverted triangle stars is one row less than that of upright triangle stars .
Code :
Print screenshots :
4. Hollow diamond
analysis : It's similar to a solid diamond , Let it show only the stars on four sides , The middle part doesn't let him show , You can judge whether it is equal to the initial value or the end value , If equal to these two values , Responsible for its output "*", If not, output spaces .
Code :
Print screenshots :
边栏推荐
猜你喜欢
若依开源框架中数据权限的使用及配置
Implementation of UART serial asynchronous communication with FPGA - transmission of single data
基于若依框架搭建商业项目
畅玩树莓派4B(一)树莓派系统安装和SSH连接
FPGA之蜂鸣器播放音乐《花海》
Verilog grammar basics HDL bits training 02
Kubernetes technology and Architecture (I)
主路径覆盖与基路径覆盖
仿抖音首页界面
Introduction to 3dslicer default extension module program
随机推荐
Introduction to 3dslicer default extension module interface
FPGA之简易频率计的设计
Kubernetes技术与架构(二)
3DSlicer导入医学图像数据
FPGA implementation of UART serial asynchronous communication - one byte data reception
Kubernetes technology and Architecture (III)
20day
小白程序员第六天
(一)DDL、DML、DQL、DCL与常见数据类型
基于IF嵌套与函数调用
JVM之GC调优原理(七)
Implementation of UART serial asynchronous communication with FPGA - transmission of single data
Data type conversion
Using OpenCV to connect cameras in 3dslicer
. Net framework introduction
3Dslicer默认扩展模块程序介绍
数据类型转换
Gocore-v2 framework API interface development concept
boolean到底占几个字节?
Detailed explanation of several connection queries