Java Code to Prints Patterns - Computer Programming

Latest

C C++ Java Python Perl Programs Examples with Output -useful for Schools & College Students

Monday, September 25, 2017

Java Code to Prints Patterns

Write a Java Code to Prints Patterns

Program:
public class JavaProgram
{
public static void main(String args[])
{
int i, j;
for(i=0; i<5; i++)
{
for(j=0; j<=i; j++)
{
System.out.print("* ");
}
System.out.println();
}
}
}

Output:
*
* *
* * *
* * * *
* * * * *

No comments:

Post a Comment