int year = 2015;//年份
int nian;
nian = year %= 4;
text = nian == 0 ? "闰年":"平年";//请填写代码
Console.WriteLine("今年是{0}", text);
int nian;
nian = year %= 4;
text = nian == 0 ? "闰年":"平年";//请填写代码
Console.WriteLine("今年是{0}", text);
2017-01-18
实际上新建一个变量来储存结果,是方便起来其他地方的调用,如果我们在代码的其他部分,想要知道结果,不必来重新开始循环,而是访问这个变量即可。
2017-01-16
for (int y = 1; y <= 7; y++)
{
for (int x = 1; x <= y; x++)
{
Console.Write(x);
}
Console.WriteLine();//换行
}
{
for (int x = 1; x <= y; x++)
{
Console.Write(x);
}
Console.WriteLine();//换行
}
2017-01-16
for(int x=1;x<=5;x++)
{
if(x%2==0)
continue;//添加关键字break或continue
Console.Write(x);
}
{
if(x%2==0)
continue;//添加关键字break或continue
Console.Write(x);
}
2017-01-16
for (var i=1;i<=12 ;i++ )//请填写代码
{
Console.WriteLine(x+" ");
}
{
Console.WriteLine(x+" ");
}
2017-01-16