wap to print following pattern??

ABCD          DCBA
ABC               CBA
AB                    BA
A                        A

the pattern is not showin up proper,,but hope u guys get it..
its kinda /\ shape formation b/w those letters

this is wat i tried out.....
int i,j....;
int m=65;

........moving on like this...
i cld only get a pattern

i know thers a lot easier and a shorter way to do this,,,,but jss not gettin it,,,
need help...to clear up those doubts on patterns like these

pranavghodke commented: This is excellent logic for printing ABCD by using ASCII values +0

Recommended Answers

All 8 Replies

Forgive the apparent pun, but you need to observe the pattern of your image. For illustration I'll supply my own example image here:


There is a pattern to each line.

The first pattern is that the number of red dots (representing spaces) decreases by one for each line. There are seven lines and the first line starts with six dots, so the first line will always be (number of lines - 1) red dots.

The second pattern is the number of green dots. The first line contains no green dots; the second line contains three green dots; and thereafter each line contains four green dots more than the last line, two added to each side of the center.

The last pattern is the number of letters on the line. The center letter of the first line is G, the seventh letter of the alphabet. There are also seven lines.

Now, consider each pattern. Put them all together into a single loop which prints a single line every time through the loop (that is, every iteration). You will have to keep track of three things: the current number of red dots, the current number of letters, and the current number of green dots.

Good luck.

Maybe it would be easier to think about it as an equilateral triangle in the middle filled with spaces. Here's an example of how to display an equilateral triangle. Then all you have to do is take care of the pattern of characters filling the surrounds.

may is end the code of this program over hear.
is this allowed if then i have just reply that is this allowed or not.


I second that motion. What?

Using a literal word by word translator is not a good idea unless you have at least a clue of the target language.... In this case I think a safe assumption is "Not allowed" :)

Sounds to me like he's in some national programming contest.

> may is end the code of this program over hear.
Something along the lines of this perhaps?
"May (please will) you send the code of this program over here (to me)"

thanks for replies....
no,, m' not in for nationl programmin dudes....
i reckon its a simple program..but jss not simple enuf for me...

i'll try to get the code....if not..i'll still need some help...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.