這個為什么出不來
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};
??????????? //請完善代碼,判斷數組中有沒有7的整倍數
??????????? bool has7=false;
??????????? for(int i=0;i<=num.Length;i++)
??????????? if(num[i]==0)
?????????? {
?????????????? has7=ture;
?????????????? break;
?????????? }
??????? }
??????? if(has7)
??????? Console.WriteLine("有7的倍數");
??????? else
??????? Console.WriteLine("沒有7的倍數");
??? }
}
2019-04-15
for循環中if的判斷語句不對,應該是num[i]%7==0