For循环创建图形
来源:互联网 发布:类似花瓣的软件 编辑:程序博客网 时间:2024/05/21 17:39
1.等腰三角形
row要自己定义赋值即可
for (int i = 0; i < row; i++) {for (int j = 0; j < row - i; j++) {System.out.print("^");}for (int k = 0; k < i * 2 - 1; k++) {System.out.print("*");}System.out.println();}
2.菱形
if (row >= 1) {int i, j;for (i = 0; i < row; i++) {for (j = 0; j < row - i; j++) {System.out.print(" ");}for (j = 0; j < 2 * i - 1; j++) {System.out.print("*");}System.out.println();}for (i = 0; i < row; i++) {for (j = 0; j < i; j++) {System.out.print(" ");}for (j = 0; j < 2 * (row - i) - 1; j++) {System.out.print("*");}System.out.println();}} else {System.out.println("输入错误,请重新输入!");}
3.用字母创建图形
for (int i = 1; i <=row; i++) {for (int j = 1; j < i; j++) {System.out.print((char)(j+96));}for (int j = i; j !=0; j--) System.out.print((char)(j+96));System.out.println();}
阅读全文
0 0
- For循环创建图形
- [java]for循环输出图形
- for循环打印图形-菱形
- for循环打印图形(循环结构)
- for循环创建列表
- for循环创建button
- for循环打印一些基本图形
- C 【for循环嵌套 图形规律 问题】
- for循环实现各种图形输出
- Java实例-for循环打印各种图形
- 代码:双重for循环打印简单图形
- for 循环创建button 算法
- android for循环创建列表
- 重温for循环创建button
- 利用for循环创建金字塔
- for循环动态创建表格
- for循环创建二维数组
- for循环创建二维数组
- 请教各位大神一个PHP问题(急)
- 草稿 -算法问题的历史。
- Unicode字符集
- 公司实战nginx之rewrite配置域名跳转
- jvm调优
- For循环创建图形
- Caesar 密码(POJ NO.1976)
- CSDN的Markdown编辑器使用1
- NGUI与Unity3d物体交叉显示的一种解决方案
- 计算:自然对数的底e和圆周率pi
- WCF 传输Dictionary<string, object>数据问题
- LeetCode 26. Remove Duplicates from Sorted Array
- Average UVA
- D