這樣不對嗎
using System;
using System.Collections.Generic;
using System.Text;
namespace Test
{
??? class Program
??? {
??????? static void Main(string[] args)
??????? {
??????????? //聲明整型數(shù)組,保存一組整數(shù)
??????????? int[] num = new int[] { 3,34,43,2,11,19,30,55,20};
??????????? bool hasSeven=false;//請完善代碼,判斷數(shù)組中有沒有7的整倍數(shù)
??????????? for(int i=0;i<mun.Length;i++)
??????????? {
??????????????? if(num[i]%7==0)
??????????????? {
??????????????????? hasSeven=true;
??????????????????? break;
??????????????? }
??????????? }
??????????? if(hasSeven)
??????????? console.writeline("有7的倍數(shù)");
??????????? else
??????????? console.wtiteline("沒有7的倍數(shù)");
??????? }
??? }
}
2016-11-27
?首先,變量名錯(cuò)了,不是 ?for(int i=0;i<mun.Length;i++),而是? ?for(int i=0;i<num.Length;i++)
其次,?這個(gè)輸入錯(cuò)了console.wtiteline("沒有7的倍數(shù)");Console大寫,WriteLine正確拼寫,還有題目輸出要求應(yīng)是"沒有7的整倍數(shù)"
2016-06-09
應(yīng)該是for(int i=0;i<num.Length;i++)?
2016-06-09
? for(int i=0;i<mun.Length;i++)
變量名寫錯(cuò)了