I am new to Java and stuck with this assignment, Although I have completed it somehow but I want to do it without the if-else statement.
for(int i=0; i<numRows; i++)
{
for(int j=0; j<numRows-i; j++)
{
System.out.print(" ");
}
for(int k = 0; k <= i*2; k++)
{
if(k%2 == 1)
System.out.print("A");
else
System.out.print("*");
}
System.out.println();
}
Output:
*
*A*
*A*A*
*A*A*A*
*A*A*A*A*