please do this i have exam after two hours ....java pattern
display this pattern
please answer
everytime i ask a question no one answer..... as if you don't know java patterns .....very annoying..
Attachments:
Answers
Answered by
5
Sample Program to print pattern in Java:
class Demo
{
public static void main(String args[])
{
for(int i = 0; i <= 5; i++)
{
int a = 65;
for(int j = 0; j <= i; j++)
{
System.out.print(" ");
}
for(int k = 0; k <= 4 - i; k++)
{
System.out.print((char) (a + k) + "");
}
System.out.println();
}
}
}
Output:
ABCDE
ABCD
ABC
AB
A
Attachments:
siddhartharao77:
:-)
Answered by
2
class Demo
{
public static void main(String args[])
{
for(int i = 0; i <= 5; i++)
{
int a = 65;
for(int j = 0; j <= i; j++)
{
System.out.print(" ");
}
for(int k = 0; k <= 4 - i; k++)
{
System.out.print((char) (a + k) + "");
}
System.out.println();
}
}
}
Similar questions