Java String Patterns Programs
Write a java string pattern programs program to print following pattern.
S
Si
Sim
Simp
Simpl
Simply
import java.util.Scanner; public class AlphabeticPattern { public static void main(String args[]) { String x ; Scanner sc= new Scanner(System.in); System.out.println("Enter the string: "); x= sc.next(); int i,j; int l = x.length(); for(i = 0;i<= l;i++) { for(j = 0;j<i;j++) System.out.print (x.charAt(j)); System.out.println (); } } }
You may also like
Single Linked List Programs in Java
28 August, 2021
Implementing Stack using Array in Java
28 August, 2021
What is Java String?
3 July, 2021