我正在尝试使用for循环。使用嵌套for循环
如果输入3,其结果将是:
1**
*2*
**3
所以我用这个代码
void button1_Click(object sender, EventArgs e) {
string message = " ";
int value = numericUpDown1.Value;
for(int count = 0; count < value; count++) {
for(int m = -2; m < value; m++) {
message += "*";
}
message += "\r\n";
}
MessageBox.Show(message);
}
我使用的两个for循环,但我不能确定它显示数, 但它给我
***
***
***
忘记它标签作为homew ork? – Habib 2012-07-25 04:14:44
你的号码将是你的计数变量+1 – 2012-07-25 04:20:42