Can you people please help me in this program using only nested loops?
I cannot use bufferedreader or charAt function
Hard coding cannot be used.
The dots all stand for spaces
The pattern is:-
abcde
.bcde
..cde
...de
....e
....ed
....edc
....edcb
....edcba
The spaces are mandatory.
The dots are all spaces

Recommended Answers

All 2 Replies

We may guide you if you post code what you made so far. Otherwise it would be handling over code to another lazy student. So show us what you got...

Oh I have solved the problem.
An excellent program I must say.
The code for the program is the following:

class patsp
{
public static void main()
{
int ch,i,k,l='d',m=1,n='a';
for (i=5;i>=1;i--)
{
for(k=3;k>=i-1;k--)
System.out.print(" ");
for(ch=n;ch<='e';ch++)
{
System.out.print((char)ch);
}
System.out.println();
n=n+1;
}
for (i=4;i>=1;i--)
{
for(k=m;k<=i;k++)
System.out.print(" ");
for(ch='e';ch>=l;ch--)
{
System.out.print((char)ch);
}
System.out.println();
l=l-1;
m=m-1;
}
}
}
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.