wap in Java to show the following pattern
A B C D E
A B C D A
A B C A B
A B A B C
A A B C D
Don't give false answers or I will report your answer....
Answers
Answered by
3
Question:-
Write a program in Java to display the following pattern.
A B C D E
A B C D A
A B C A B
A B A B C
A A B C D
Program:-
This is written in Java. For verification, check out the attachment.
class Main
{
public static void main(String s[])
{
char a='A';
for(int i=1;i<=5;i++)
{
a='A';
for(int j=1;j<=5-i+1;j++)
System.out.print(a++ + " ");
a='A';
for(int j=1;j<=i-1;j++)
System.out.print(a++ +" ");
System.out.println();
}
}
}
Attachments:
Similar questions