namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
/*循环语句*/
//for循环
int i,j;
string x = "*";
string y=" ";
for (i = 0; i <= 10; i++)
{
for (j = 0; j <= i; j++)
{
Console.Write(x);
}
Console.WriteLine("");
}
//while循环
int x1;
x1 = 10;
while (x1 != 1)
{
x1--;
Console.WriteLine(x1);
if (x1 == 5)
{
break;
}
continue;
}
//do while循环
int y1=90;
do
{
y1++;
Console.WriteLine(y1);
}
while (y1 < 100);
//foreach循环
string[] str = {"one","two","three","four" };
foreach (string s in str)
{
Console.WriteLine(s);
}
Console.ReadKey();//等待user输入
}
}
}