How do you print such problem?
Enter a letter
Ex. f
ffffff
ffffff eeeee
ffffff eeeee dddd
ffffff eeeee dddd ccc
ffffff eeeee dddd ccc bb
ffffff eeeee dddd ccc bb a
Ex. c
ccc
ccc bb
ccc bb a
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
How do you print such problem?
Enter a letter
Ex. f
ffffff
ffffff eeeee
ffffff eeeee dddd
ffffff eeeee dddd ccc
ffffff eeeee dddd ccc bb
ffffff eeeee dddd ccc bb a
Ex. c
ccc
ccc bb
ccc bb a
Last edited by cosecant; October 15th, 2009 at 06:58 PM. Reason: typing error
Hello cosecant,
Welcome to the Java Programming Forums.
Can you please give a bit more detail about the desired output?
Please use [highlight=Java] code [/highlight] tags when posting your code.
Forum Tip: Add to peoples reputation by clicking the button on their useful posts.
You input a letter. Then you print it its place in the alphabet time(for example b would be bb).
Then you print it again and then add the letter before it, its corresponding position number of times.
Continue adding as seen in example until a is reached.
Ex. d
dddd //The letter its postions times
dddd ccc // letter again and letter before its position times
dddd ccc bb // continuing on
dddd ccc bb a // finished
What code do you have so far, where exactly are you stuck?
// Json
I have use multiple for loops, but i have had trouble getting it to print the middle line for example
I have been able to print(for ex.f) ffffff and ffffff eeeee dddd ccc bb a, but i cannot figure out the for loop required to keep adding characters while keeping the previous ones.
Save a string of what you're printing out.
String output = ""; for (number of lines to print out) output += number of characters to add System.out.println(output);