1 B. Write a Java program to display the following pattern.
*****
****
***
**
*
Program:
class StarPattern
{
public static void main(String args[])
{
for(int i=5;i>0;i--)
{
for(int j=1;j<i;j++)
{
System.out.print("*");
}
System.out.println(" ");
}
}
}
Comments
Post a Comment