Reverse the Pattern of this output
Hello everyone, I am a first year student and i have a home work. i solved the first problem but the second one i cannot, this is the
code and output..
Code Java:
public class exe2
{
public static void main(String[] args) {
int x,y;
for(x=10; x>0; x--)
{
for (y=0; y<x; y++)
{
System.out.print("*_");
}
System.out.println();
}
}
}
OUTPUT
*_*_*_*_*_*_*_*_*_*_
*_*_*_*_*_*_*_*_*_
*_*_*_*_*_*_*_*_
*_*_*_*_*_*_*_
*_*_*_*_*_*_
*_*_*_*_*_
*_*_*_*_
*_*_*_
*_*_
*_
please help me to debug the code and reverse the output like this..
*_
*_*_
*_*_*_
*_*_*_*_
*_*_*_*_*
*_*_*_*_*_*_
thank you...
Re: Reverse the Pattern of this output
What is there to debug? Pay attention to what the loops are doing. Work through this by hand, with a piece of paper and a pencil, to get a better idea of what's going on.
Re: Reverse the Pattern of this output