Computer Science, asked by barbie3762, 10 months ago

write a program in Java to print the following pattern
*
##
***
####
*****

Answers

Answered by garywalter1221
3

its easy


u have to only use if else and for loop

if else (because for even and odd places )


for ex.


logic of program


for(i=1;i<=5;i++)

{

 for(j=1;j<=i;j++)

{

 if(i%2==0)

{

 system.out.print("#");

}

else

system.out.print("*");

}

system.out.println();

}


I hope this will help u

Similar questions