[nbusers] Re: Need help"write a program to print triangular with * "

  • From: Ion Iovu < >
  • To:
  • Subject: [nbusers] Re: Need help"write a program to print triangular with * "
  • Date: Tue, 27 Nov 2012 11:39:53 +0200

Soonwh,

this is clearly homework. The best thing I can do is give you some references.
You can find out how you can work with command line arguments:
Even translating a command line argument (which is necessarily a String) to a integer, which you need is documented on that page:
firstArg = Integer.parseInt(args[0]);
Regards


On Tue, Nov 27, 2012 at 5:10 AM, Soonwh < " target="_blank"> > wrote:
I need help to write a program that takes a command-line argument N and print and N-by-N triangular pattern as below:-

******
.*****
..****
...***
....**
.....*


i done half of it, but other part i cant get it.

package ass1;

public class Ass1 {

   public static void main(String[] args)

   {
       int x, y ;
       for(x=1; x<=6; x++)

       {
           for ( y=1; y<x; y++)


       {
           System.out.print("*");
       }

       {
       System.out.println();
       }

       }
   }







[nbusers] Need help"write a program to print triangular with * "

Soonwh 11/27/2012

[nbusers] Re: Need help"write a program to print triangular with * "

Ion Iovu 11/27/2012

[nbusers] Need help"write a program to print triangular with * "

Soonwh 11/27/2012

Project Features

About this Project

www was started in November 2009, is owned by jpirek, and has 21 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20131025.e7cbc9d). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close