Thursday, 11 February 2016

Print Star Pattern in Java

Print Star Pattern in Java

In java programming you can easily print star pattern in java. For this code you need to follow same concept which is used in java only change syntax of C language into Java.

Print Star Pattern in Java

Pattern

*
**
***
****
*****
******
*******
********
*********
**********

Example To Print Triangle of Star in Java

public class StarDemo
{
public static void main(String[] args)
{
for(int i = 0; i < 10; i++)
{
for(int j=i+1;j>0;j--)
{
System.out.print("*");
}
System.out.println();
}
}
}

Pattern

********
*******
******
*****
****
***
**
public class StarDemo
{
public static void main(String[] args)
{
for(int i = 0; i < 10; i++)
{
for(int j=i+1;j>0;j--)
{
System.out.print("*");
}
System.out.println();
}
}
}

1 comment:

  1. Really nice blog post.provided a helpful information.I hope that you will post more updates like this AngularJS Online Course Hyderabad

    ReplyDelete