[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: I have a problem help me



Alle 19:50, giovedì 10 novembre 2005, Vardan Gevorgyan ha scritto:
> On Thursday 10 November 2005 09:53 pm, Avik Chatterjee wrote:
> > *******
>
> public class Starts {
>     public static void main(String[] args) {
>         printStarts(7);
>     }
>
>     public static void printStarts(int count) {
>         int startsCount = 1;
>         int spaceCount = count/2;
//!!!! if count < 2 ????
	if(count < 2)
		count = 2;
// or exit();
>
>         while(startsCount <= count) {
>             for(int i = 0; i < spaceCount; i++)
>                 System.out.print(" ");
>             for(int p = 1; p <= startsCount; p++)
>                 System.out.print("*");
>             System.out.println();
>             startsCount += 2;
>             spaceCount--;
>         }
>     }
> }



Reply to: