hi..
how can we print following series....?
1
22
333
4444
55555
666666
7777777
88888888
999999999
88888888
7777777
666666
55555
4444
333
22
1
How to print series
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Prabhu RajaRank #861 · 2.6K reputationPosted Oct 2, 2011, 9:43 PM EDT
int[] array = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
// Print.
foreach (int value in array)
{
for (int i = 0; i < value; i++)
this.TextBox1.Text += value.ToString();
this.TextBox1.Text += System.Environment.NewLine;
}
// Reverse.
Array.Reverse(array);
// Print.
foreach (int value in array)
{
for (int i = 0; i < value && value != 9; i++)
{
this.TextBox1.Text += value.ToString();
}
if (value != 9 )
this.TextBox1.Text += System.Environment.NewLine;
}
-------------------------------------------------------------
If this post helps you, then mark as "Correct Answer"
Thank You