Tuesday, 29 September 2015

Java Program to output starts in a pattern


public class Stars {

public static void main(String[] args) {
// TODO Auto-generated method stub
//int i,j;
for(int i=1;i<5;i++)
{
for(int j=1;j<=i;j++)
{
System.out.print("*");
}
System.out.println();
}
}

}


Output:-
*
**
***
****

No comments:

Post a Comment