已采纳回答 / 慕粉3508730
【【【 { Console.WirteLine("有7的整倍数");}】】】 else {Console.WriteLine("没有7的整倍数"); }倒数第三行代码拼写错误,Write拼写成Wirte
2017-01-19
Console.WriteLine("我叫{0},是{1}生,今年{2}岁,身高{3}米。",name,sex,age,height);
字符串中用{0}~{3}表示将会输出4个变量的值,而四个变量依次写在字符串后面。
字符串中用{0}~{3}表示将会输出4个变量的值,而四个变量依次写在字符串后面。
2017-01-19
int year = 2015;//年份
string text;
int nian;
nian = year %= 4;
text = nian == 0 ? "闰年":"平年";//请填写代码
Console.WriteLine("今年是{0}", text);
%= 这个运算好想无法用于(int+string类型)中操作,可以打开vs试一试。。。
string text;
int nian;
nian = year %= 4;
text = nian == 0 ? "闰年":"平年";//请填写代码
Console.WriteLine("今年是{0}", text);
%= 这个运算好想无法用于(int+string类型)中操作,可以打开vs试一试。。。
2017-01-18
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