private void Add_Stars(int amtStars)
{
string[] stars = new string[amtStars];
char astrik = '*';
int count = 1;
for (int i = 0; i < stars.Length; i++)
{
stars[i] = new string(astrik, count);
count++;
listBox1.Items.Add(stars[i]);
}
for (int i = 0; i <= stars.Length; i++)
{
if(i == stars.Length)
{
for(int j = i - 2; j != 0; j--)
{
listBox1.Items.Add(stars[j]);
}
break;
}
stars[i] = new string(astrik, count);
count++;
listBox1.Items.Add(stars[i]);
}
private void button1_Click(object sender, EventArgs e)
{
Add_Stars(Convert.ToInt16(textBox1.Text));
}
Copyright © 2024, NextGenUpdate.
All Rights Reserved.