Print Triangle inside a rectangle
- From: unixdomain@xxxxxxxxx
- Date: 29 Mar 2007 10:47:19 -0700
Hello,
I want to print a triangle, made of blanks or asterics inside a
rectangle made of alphabets.
It's as follows;
ABCDEFGFEDCBA
ABCEEF FEDCBA
ABCDE EDCBA
ABCD DCBA
ABC CBA
AB BA
A A
It has 7 rows and 13 columns. I tried to implement like this;
do {
if(j == rows) //int j=0, int row=1
for(int c=0;c<arr.length;c++) //char
arr[]={'A','B','C','D','E','F','G','F','E',.....};
if(c==maxCol) //int maxCol=6;
arr[c]=b; //char b = ' ';
----------------------------------------------------
_FROM THIS POINT I CAN'T PROCEED!____________________________
for(blank=0;blank<maxBlank;blank++)
arr[blank]=b;
maxBlank+=2;
maxCol--;
row++;
j++;
}while(j<=6);
Plz help.
.
- Follow-Ups:
- Re: Print Triangle inside a rectangle
- From: RedGrittyBrick
- Re: Print Triangle inside a rectangle
- Prev by Date: Re: problem with applet access to web service
- Next by Date: io: how many imgs in 'images' folder?
- Previous by thread: Re: New to Java - quick question on embedding in browser
- Next by thread: Re: Print Triangle inside a rectangle
- Index(es):
Relevant Pages
|
|