Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

Pattern Programs in Java.

import java.io.*;
 
// Java code to demonstrate star patterns
public class GeeksForGeeks
{
    // Function to demonstrate printing pattern
    public static void printStars(int n)
    {
        int i, j;
 
        // outer loop to handle number of rows
        //  n in this case
        for(i=0; i<n; i++)
        {
 
            //  inner loop to handle number of columns
            //  values changing acc. to outer loop   
            for(j=0; j<=i; j++)
            {
                // printing stars
                System.out.print("* ");
            }
 
            // ending line after each row
            System.out.println();
        }
   }
 
    // Driver Function
    public static void main(String args[])
    {
        int n = 5;
        printStars(n);
    }
}
Comment

PREVIOUS NEXT
Code Example
Java :: de caracter a string en java 
Java :: Value Change Listener to JTextField 
Java :: android snackbar message is behind back button 
Java :: jdk jre jvm 
Java :: The superclass "jakarta.servlet.http.HttpServlet" was not found on the Java Build Path 
Java :: how to find odd and even in a array 
Java :: put in spring rest api 
Java :: feign client url from properties 
Java :: new in t arrray java 
Java :: java do while loop 
Java :: for each loop in java 
Java :: java variable 
Java :: Java Define a Functional Interface in java 
Java :: random number 
Java :: procedure java 
Java :: java dictionary initialization 
Java :: find first and last position of element in sorted array 
Java :: parameterized constructor java 
Java :: how to remove last latter in word in java 
Java :: how to add element to dictionary 
Java :: terminate function calling in java 
Java :: firestore java timestamp 
Java :: generic variable java 
Java :: Java Iterating through LinkedList 
Java :: How to remove an element from a Java List? 
Java :: java unicode characters 
Java :: lopping rows rethinkdb 
Java :: calculate the area of two squares in java by using a method 
Java :: java cant use string functions after changing an integer into string 
Java :: generate random color java 
ADD CONTENT
Topic
Content
Source link
Name
4+5 =