Re: Need help with loop
- From: Patricia Shanahan <pats@xxxxxxx>
- Date: Mon, 30 Oct 2006 02:09:45 GMT
meena.desani wrote:
why isn't the second part of my triangle not working?
import java.util.*;
public class triangle
{
public static void main(String[] args)
{
int nLines = 5;
for (int row = 1; row <= nLines; row++)
{
for (int star= 1; star <= row; star++)
System.out.print("*");
System.out.println();
}
}
}
If you really mean "Why isn't it not working?" the answer is because the
loops are correct, assuming you wanted a triangle of asterisks, though
very untidy.
Patricia
.
- References:
- Need help with loop
- From: meena.desani
- Need help with loop
- Prev by Date: Re: Need help with loop
- Next by Date: Need help with JFrame app
- Previous by thread: Re: Need help with loop
- Next by thread: Need help with JFrame app
- Index(es):