Question MessageBox / InputBox question involving Do While Loops

peterthottam

Member
Joined
Oct 20, 2012
Messages
6
Programming Experience
Beginner
Question: How to code using MesssageBox and w/ do-while loops? I want o be able to obtain (via InputBox function) from the user and print a pyramid of numbers where 1 is at the top and each row then builds successively by adding one to the previous one, i.e. so row 2 would have 12, and row three 123 and the pyramid base is numbers 1 through n where n is the number the user entered.
The output must be in just one messagebox and the code has to work for all positive number entries of 'n'. I've been thinking about MessageBox implementations but can't come up with anyihing. Any ideas?
 
It's really got nothing to do with the MessageBox. It simply displays a String. You need to construct the String and then display it in a MessageBox like you would any other String. There are various ways to do that. You could use a StringBuilder or you use an array or collection and call String.Join.
 
Back
Top