Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

print star 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 #star #pattern #java
ADD COMMENT
Topic
Name
2+5 =