package com.xiaowu.demo;

/**
*
*
打印出如下图案(菱形) *
*
*
* @author WQ
*
*/
public class Demo20 {
public static void main(String[] args) {
display(5);
} public static void display(int h) {
for (int i = 0; i < (h + 1) / 2; i++) {
for (int j = 0; j < h / 2 - i; j++) {
System.out.print(" ");
}
for (int k = 1; k < (i + 1) * 2; k++) {
System.out.print("*");
}
System.out.println();
}
for (int i = 1; i <= h / 2; i++) {
for (int j = 1; j <= i; j++) {
System.out.print(" ");
}
for (int j = 0; j < h - 2 * i; j++) {
System.out.print("*");
}
System.out.println();
}
}
}

最新文章

  1. HTTP权威协议笔记-7.缓存
  2. UWP入门教程1——UWP的前世今生
  3. spring mvc WebArgumentResolver不生效
  4. MIT 6.828 JOS学习笔记0. 写在前面的话
  5. Swift3.0语言教程替换子字符串
  6. 小心!#define max(a,b) a&gt;b?a:b
  7. c# 实现文件批量压缩
  8. 模板方法模式(TemplateMethod)
  9. iOS WebView的用法
  10. leetcode-004 insertion sort list
  11. [转]JAVA自动装箱和拆箱
  12. ojdbc6下载地址
  13. win7 win10开启网络访问(网络访问 无法访问 网络访问需要输入密码 等问题处理)
  14. Coroutines declared with async/await syntax is the preferred way of writing asyncio applications. For example, the following snippet of code (requires Python 3.7+) prints “hello”, waits 1 second, and
  15. 使用InstallAnywhere7.1制作Java exe程序安装包
  16. sap 对dynamic query parameters 设置条件。
  17. select标签和多行文本标签
  18. Architecture And Framework
  19. 第一个python程序(2)
  20. elasticsearch中ik词库配置远程热加载

热门文章

  1. jQuery基础知识点(下)
  2. cf 834 E. Ever-Hungry Krakozyabra
  3. BZOJ1196 [HNOI2006]公路修建问题 【二分 + Kruskal】
  4. 【CZY选讲&#183;Triangle】
  5. ie6中margin失效问题
  6. PHP AES128加密解密
  7. 倒置函数reverse的用法
  8. python自动化测试windows gui
  9. 1.Openstack-环境安装
  10. HTML5 canvas上画文字出现乱码