Write a java programme using functions to print the following pattern in java .

 public class mul{
    
    
    static void pattern (int n){
    for (int i=0; i<n; i++){
    for (int j=0; j<i+1; j++){
        System.out.print("*");}
        System.out.println();}}

    public static void main (String args[]){
    
    
    pattern(5);

} }

Comments

Popular posts from this blog

Create an array of 5 floats and calculate their sum in java .