hi..
how can we print following series....?
1
22
333
4444
55555
666666
7777777
88888888
999999999
88888888
7777777
666666
55555
4444
333
22
1
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Prabhu RajaPosted Oct 3, 2011, 1:43 AM
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