打印一个空心菱形
2007-11-24 16:04
357 查看
import java.io.InputStreamReader; public class Work ...{ public static void main(String[] args) throws IOException ...{ int len; // 菱长 String outstr=new String(); // 输出 int i,j,x,y; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); System.out.println("请输入一个菱长:"); String str = br.readLine(); len=Integer.parseInt(str); for(i=0;i<=len*2;i++)...{ for(j=0;j<=len*2;j++)...{ x=len-i; x=x<0?-1*x:x; y=len+(len-x); outstr+=(j==x||j==y?"*":" "); } outstr+=" "; } System.out.println(outstr); } }
相关文章推荐
- java 实现打印输出一个空心菱形
- 在控制台打印一个空心的菱形
- 任意输入一个数,打印对应的空心实心金字塔以及菱形
- (四)、利用命令行参数输入一个整数,打印空心菱形
- Java控制台打印一个空心菱形
- 打印空心菱形
- java 打印输出空心菱形
- 打印空心字符菱形
- 运用循环输出一个空心的菱形
- 用java打印空心菱形
- 打印菱形和空心菱形
- 打印空心菱形
- 如何使用JAVA打印菱形(三)空心菱形基础上加上对角线
- C# 打印实心菱形与空心菱形
- 菱型起始字母和菱形的高度,打印空心的由字符组成的菱形
- 拉丁方阵、打印菱形(实心or空心)
- 打印图形——空心字符菱形
- 打印一个菱形,用其他字符填充空白区域
- 代码:打印一个如图所示的菱形
- 2018/03/05-day01:打印出一个菱形