ArrayList arry2 = new ArrayList();
int a = 8;
int c = 1;
arry2.Add(1);
Begin:
for (int b = 2;b<=a;b++ )
{
if(a%b==0)
{ arry2.Add(b);
c = b * c;
a = a/b;
Label1.Text = "不是質數";
goto Begin;
}
else
{
Label1.Text = "是質數";
}
}
arry2.Add(c);
GridView2.DataSource = arry2;
GridView2.DataBind();
沒有留言:
張貼留言