Q:

Java program to print the following pattern on the console

belongs to collection: Java Pattern programs

0

Algorithm:

  • STEP 1: START
  • STEP 2: DEFINE i, j
  • STEP 3: SET n=6
  • STEP 4: SET i=n. REPEAT STEP 5 to STEP 7 UNTIL i>0.
  • STEP 5: SET j=0. REPEAT STEP 6 UNTIL j<i.< li=""></i.<>
  • STEP 6: PRINT * and SET j=j+1
  • STEP 7: PRINT "" and SET i=i-1.
  • STEP 8: END

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Program:

class pattern     
    
   public static void main(String[] args)     
   {    
       int i ,j;    
       int n = 6;    
           for(i = n; i>0 ; i-- )    
           {    
                for(j = 0; j<i ; j++)    
                   {    
                       System.out.print("*");    
                   }    
                        System.out.println("");    
           }        
   }    

 

Output:

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Java program to print the following pattern on the... >>
<< Java program to print the following pattern on the...