How to make a Triangle pattern usingGiven String

How to make a Triangle pattern usingGiven String
SOURCE : StringTriangle.java

public class StringTriangle {

public static void main(String[] args) {

String str = "aabbcde";

for (int i = 0; i < str.length(); i++) {

System.out.println(str.substring(0, i + 1));

}

}

}



INPUT

String str = "aabbcde"



OUTPUT

a
aa
aab
aabb
aabbc
aabbcd
aabbcde






Sandeep Kumar D

Hi, I have written and developed this post so that most of people will be benefited. I'm committed to provide easy and in-depth tutorials on various technologies.I hope it will help you a lot.

- Sandeep Kumar D

Follow Me @Google+




SHARE

    Blogger Comment
    Facebook Comment

0 comments :

Post a Comment