Java program to print the word in following pattern

 Java program to print the word “CODING” in following pattern

output
PATTERN OUTPUT



import java.util.Scanner;

public class demo{
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        sc.close();
        for(int i=0;i<str.length();i++){
            for(int j=0;j<=i;j++){
                System.out.print(str.charAt(j));
            }
            System.out.println();
        }
    }
}

Comments