Question Stacking of letters

erica28

New member
Joined
Feb 9, 2017
Messages
3
Programming Experience
Beginner
hi, i am new here and a beginner in programming..
i would like to ask how can i make a staking of letters..
for example..

i will ask the user " how many stacks do you need: 5 "

the output will be

A
AA
AAA
AAAA
AAAAA

if anyone can help me on how to do it in c#

thank you in advance
 
Presumably you have been given a homework assignment on using loops. Noone is going to just pluck that sort of thing out of the air but I notice that you gave no indication that it's homework, so I think that you're being just a little bit dishonest there.

As you should do for any programming problem, you should start by forgetting that it's a programming problem. Pretend that you have to write out a set of instructions for a human being to follow to achieve this with pen and paper. Now, instead of pretending, actually do it, i.e. write out those instructions. Keep in mind that those instructions should be a mathematical algorithm. If the point is to work with a loop then obviously there needs to be some repetition in the instructions.

Once you have the instructions, you have your solution to the problem. All that remains is to write code to implement those specific instructions. As you test the code, you can compare its behaviour at every step to your expectation based on your set of instructions. If the code doesn't work then either it doesn't implement your instructions or your instructions are wrong but you know exactly where reality diverged from expectation so you know exactly where to look to fix the problem.
 
Back
Top Bottom