Java 实例 – 打印平行四边形

Java 教程 · 2019-02-10 19:27:17

输出平行四边形。

实例

public class Parallelogram { public static void main(String[] args) { //外层循环 每次打出一个* for (int i = 1; i <=5; i++) { //填充空格 for (int j = 1; j <= 5 - i; j++) { System.out.print(" "); } //内层循环 每次打印一个* for (int k = 1; k <= 5; k++) { System.out.print("*"); } System.out.println(); } } }

输出结果:

    *****
   *****
  *****
 *****
*****

点击查看所有 Java 教程 文章: https://codercto.com/courses/l/12.html

查看所有标签

Spring in Action

Spring in Action

Craig Walls / Manning Publications / 2011-6-29 / USD 49.99

Spring in Action, Third Edition has been completely revised to reflect the latest features, tools, practices Spring offers to java developers. It begins by introducing the core concepts of Spring and......一起来看看 《Spring in Action》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

URL 编码/解码
URL 编码/解码

URL 编码/解码