請(qǐng)幫幫我看看吧
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 has7=false;
? ? ? ? ?for(int=0;i<num.Length;
? ? ? ? ?i++)
? ? ? ? ?if (num[i]%7==0)
? ? ? ? ?has7=true;
? ? ? ? ?break;
? ? ? ? ?if?
? ? ? ? ?(has7)
? ? ? ? ?Console.WriteLine("");
? ? ? ? ?else
? ? ? ? ?Console.WriteLine("");
? ? ? ? ?//請(qǐng)完善代碼,判斷數(shù)組中有沒(méi)有7的整倍數(shù)
? ? ? ? ? ??
? ? ? ? }
? ? }
}
2021-03-06
自我debug已經(jīng)完成:
15行for循環(huán)中int=0是錯(cuò)誤的,應(yīng)為int i=0。
接下來(lái)會(huì)因?yàn)槲沂褂昧薭reak而報(bào)錯(cuò),刪除break;即可解決問(wèn)題。