java - nested for loop for alphabet increment -


I have searched everywhere and how can I create this output in Java by using nested for loop:

"a

ab

abc

abcd"

until z

That's what I've tried.

string alphabet = "abcdefghijklmnopqrstuvwxyz";

 for  (int i = 0; i & lt; = 25; i ++) {for (char j = (char) (Alphabet.charAt (i)); j &   

Please help me! < / Div>

Here is the answer: {for (int i = 'a'; i & lt; = x; i ++) {System.out}

 for  (int x = 'a'; x & lt; = 'z'; x ++) print ((four) i);} system.out .println ();}   

The external loop switches from one line to another, while the internal loop prints the characters of that particular line.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -