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();//换行
}
2021-02-08
{ if (x >= 5) {Console.WriteLine("5" }else { if (y >= 6) { Console.WriteLine("6"); }else
{
Console.WriteLine("7");
}
}
}
else
{
Console.WriteLine("6");
}
{
Console.WriteLine("7");
}
}
}
else
{
Console.WriteLine("6");
}
2021-01-28
//请完善代码,判断数组中有没有7的整倍数
bool hasSeven = false;
foreach (int temp in num) {
hasSeven = temp % 7 == 0 ? true : false ;
if(hasSeven)
break;
}
Console.Write(hasSeven ? "有7的整倍数" : "没有7的整倍数");
bool hasSeven = false;
foreach (int temp in num) {
hasSeven = temp % 7 == 0 ? true : false ;
if(hasSeven)
break;
}
Console.Write(hasSeven ? "有7的整倍数" : "没有7的整倍数");
直接改成Console.WriteLine(true);也行...系统只检查最后输出内容,不管中间过程合理不合理
2020-11-02
明白了。
1. bool a = ++x * x > 3;
bool b = a;
2. bool a = ++x * x > 3;
bool b = ++x * x > 3;
1. bool a = ++x * x > 3;
bool b = a;
2. bool a = ++x * x > 3;
bool b = ++x * x > 3;
2020-10-30