//请完善代码,判断数组中有没有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
太粗心了,小错误不断:
1..数组声明完忘写“;”
2.for错写成foreach
3.i忘记声明int
4.for循环内应用“;”隔开而不是“,”
5.Console.Write首字母大写
6.忘记}对应
1..数组声明完忘写“;”
2.for错写成foreach
3.i忘记声明int
4.for循环内应用“;”隔开而不是“,”
5.Console.Write首字母大写
6.忘记}对应