Print star pattern in java
Here i will show you how to
print star pattern in java in java programming same concept are apply to write this code only you need to change C or C++ syntax.
Pattern
*
***
*****
*******
*********
***********
*************
***************
public class StarPattern
{
public static void main(String[] args)
{
for(int i = 10; i > 0; i--)
{
for(int j=1;j<i+1;j++)
{
System.out.print("*");
}
System.out.println();
}
}
}
*
**
***
****
*****
class StarPattern
{
public static void main(String[] args)
{
int j, i;
for (row = 1; j<= 10; j++)
{
fori= 1; i<= j; i++)
{
System.out.print("*");
}
System.out.println();
}
}
}
No comments:
Post a Comment