Activity Stream
48,167 MEMBERS
6751 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Results 1 to 3 of 3
  1.     
    #1
    Member
    Website's:
    downloadgroup.net

    Default please help me in java

    i want print following patterns in java please help me






    first one i know
    but i don't know how to change other patterns
    please help me

    first one code


    Code: 
    public class nested1
    
        {
        public static void main(String a[])
            
            for(row col = 1; row <=5; row++)
                {
                for(int col = 1; col <=10; col++)
                    {
                    {System.out.print('*');
                    }
                }    
                
                    System.out.println();
        }

    shanshayan Reviewed by shanshayan on . please help me in java i want print following patterns in java please help me http://s19.postimage.org/qjjuudaoj/09012012337.jpg first one i know but i don't know how to change other patterns Rating: 5

  2.   Sponsored Links

  3.     
    #2
    Respected Member
    Work off these:
    Code: 
    class nested1
    {
      public static void main (String[] args) throws java.lang.Exception
       { 
         int row=1;  int col=0; char ast='*'; // Declare and initialize loop counter
         while (row < 6) 
         { // Test and Loop
           System.out.println(row);
           col=0;  
           while (col<row) { System.out.print(ast); col++; }
           System.out.println();
           row++;     // Increment Loop Counter
         }
         System.out.println();  // Finish the line 
       }
    }
    
    *
    **
    ***
    ****
    *****
    
    class nested1
    {
      public static void main (String[] args) throws java.lang.Exception
       { 
         int row=1;  int col=0; char ast='*'; // Declare and initialize loop counter
         while (row < 6) 
         { // Test and Loop
           col=6;  
           while (col>row) { System.out.print(ast); col--; }
           System.out.println();
           row++;     // Increment Loop Counter
         }
       }
    }
    
    *****
    ****
    ***
    **
    *
    
    class nested1
    {
      public static void main (String[] args) throws java.lang.Exception
       { 
         int row=1; int col1=0; int col2=0; int ctr=1;
         while (row < 8) 
         { if (row<5) { col1=5-row; col2=3+row; } else { col1=row-3; col2=11-row; } 
             ctr=1;
           while(ctr<8) { if (col1==ctr || col2==ctr) { System.out.print('*'); ctr++; } else { System.out.print(' '); ctr++; } }
                 System.out.println();
                 row++;     // Increment Loop Counter
         }
       }
    } 
    
       *   
      * *  
     *   * 
    *     *
     *   * 
      * *  
       *

  4.     
    #3
    Member
    Website's:
    downloadgroup.net
    please help fifth one(e)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Java stinks: Turn off your Java browser plugin
    By Loget in forum General Discussion
    Replies: 37
    Last Post: 5th Sep 2012, 07:40 AM
  2. Need help in JAVA
    By digimon in forum Web Development Area
    Replies: 10
    Last Post: 20th Jan 2012, 04:53 AM
  3. HELP: Java countdown
    By CuraHack in forum Web Development Area
    Replies: 4
    Last Post: 9th Nov 2011, 02:42 AM
  4. In need of JAVA Developer
    By avngr in forum Web Development Area
    Replies: 2
    Last Post: 1st Sep 2011, 02:44 PM
  5. Some help need in Java programing
    By bapi21 in forum Web Development Area
    Replies: 1
    Last Post: 10th Jul 2011, 01:08 PM

Tags for this Thread

BE SOCIAL