Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

print * pattern in java

public class Pattern   
{   
public static void main(String args[])   
{   
    
//outer loop for rows  
for(int i=5; i>=1; i--)   
{   
//inner loop for columns  
for(int j=1; j<=i; j++)   
{   
//prints stars   
System.out.print("*");   
}   
//throws the cursor in a new line after printing each line  
System.out.println();   
}   
}   
}  


Output:
*****
****
***
**
*
 
PREVIOUS NEXT
Tagged: #print #pattern #java
ADD COMMENT
Topic
Name
1+2 =