public static void main(String[] args) {
for (int i = 0; i <10 ; i++) {
for (int j = i; j <10 ; j++) {
System.out.print(" * ");
}
System.out.println();
}
}
/*
* * * * * * * *
* * * * * * *
* * * * * *
* * * * *
* * * *
* * *
* *
*
*/
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:
*****
****
***
**
*