這樣不對嗎
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 hasSeven=false;//請完善代碼,判斷數組中有沒有7的整倍數
??????????? for(int i=0;i<mun.Length;i++)
??????????? {
??????????????? if(num[i]%7==0)
??????????????? {
??????????????????? hasSeven=true;
??????????????????? break;
??????????????? }
??????????? }
??????????? if(hasSeven)
??????????? console.writeline("有7的倍數");
??????????? else
??????????? console.wtiteline("沒有7的倍數");
??????? }
??? }
}
2016-11-27
?首先,變量名錯了,不是 ?for(int i=0;i<mun.Length;i++),而是? ?for(int i=0;i<num.Length;i++)
其次,?這個輸入錯了console.wtiteline("沒有7的倍數");Console大寫,WriteLine正確拼寫,還有題目輸出要求應是"沒有7的整倍數"
2016-06-09
應該是for(int i=0;i<num.Length;i++)?
2016-06-09
? for(int i=0;i<mun.Length;i++)
變量名寫錯了