找不出問題,Vosual C# 2010上可以運行,為什么會顯示檢測到無法訪問的代碼i
?int[] num = new int[] { 3,34,43,2,11,19,30,55,20};
? ? ? ? ? ? bool a=false ? ;
? ? ? ? ? ? for (int i = 0; i < num.Length;i++ ) //請完善代碼,判斷數組中有沒有7的整倍數
? ? ? ? ? ? {
? ? ? ? ? ? ? ? if (num[i] % 7 == 0)
? ? ? ? ? ? ? ? ? ? a = true;
? ? ? ? ? ? ? ? break;
? ? ? ? ? ? }
? ? ? ? ? ? ? ?{
? ? ? ? ? ? ? ? ? ?if (a)
? ? ? ? ? ? ? ? ? ? ? ?Console.WriteLine("有7的整數倍");
? ? ? ? ? ? ? ? ? ?else
? ? ? ? ? ? ? ? ? ? ? ?Console.WriteLine("沒有7的整數倍");
? ? ? ? ? ? ? ? }
? ? ? ? ? ? Console.ReadLine();
2016-11-27
VS輸出應該是“沒有7的整倍數”吧?沒有“按任意鍵繼續...”吧?
你用了Console.ReadLine(); 意思是等待接受從鍵盤輸入的數據,而沒有讓程序結束。。
2016-05-05
? Console.ReadLine(); ?給刪了 就可以了 慕課檢查方面做得比較無解