這個怎么不行??
? bool has7=false;
? ? ? ? ? ? for(int i=0;i<num.Length;i++)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? if(num[i]%7==0)
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? has7=true;
? ? ? ? ? ? ? ? ? ? break;
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
? ? ? ? ? ? if(has7)
? ? ? ? ? ? Console.WriteLine("有7的整倍數");
? ? ? ? ? ? else
? ? ? ? Console.WriteLine("沒有7的整倍數");
2019-03-15
倒數第三行的分號是中文符號
2018-08-30
using?System; using?System.Collections.Generic; using?System.Text; namespace?Test {???? ???class?Program? ?????{?????? ????????static?void?Main(string[]?args)?? ?????????{???????????? ??????????int[]?num?=?new?int[]?{?3,34,43,2,11,19,30,55,20}; ??????????bool?nu=false;? ??????????for(int?i=0;i<num.Length;i++)??? ???????????{? ?????????????if(num[i]%7==0)? ?????????????nu=true;?????? ?????????????break;? ???????????}? ???????????Console.Write(nu?"有7的整倍數":"沒有7的整倍數");? ??????????}?? ??????} }2018-07-03
int[] num = new int[] { 3,34,43,2,11,19,30,55,20};
??????????? //請完善代碼,判斷數組中有沒有7的整倍數
??????????? bool pd=false;
??????????? for(int i=0;i<num.Length;i++)
??????????? {
??????????????? if(num[i]%7==0)
??????????????? {
??????????????????? pd=true;
??????????????????? break;
??????????????? }
?????????????? ?
?????????????? ?
??????????? }
??????????? if(pd)
??????????????? {
??????????????????? Console.Write("有7的倍數");
?????????????????? ?
??????????????? }
??????????????? else
??????????????? {
??????????????????? Console.Write("沒有7的整倍數");
??????????????? }
2018-05-30
代碼沒問題,我復制運行了一下,是因為你的分號沒有用半角標點