為什么錯了
bool has7beishu=false;
? ? ? ? ? ? for(int i=0;i<=num.Length;i++)
? ? ? ? ? ? ?if(num[i]%7==0)
? ? ? ? ? ? ?{
? ? ? ? ? ? ? ? ?has7beishu=true;
? ? ? ? ? ? ? ? ?break;
? ? ? ? ? ? ?}
? ? ? ? ? ? ?if(has7beishu)
? ? ? ? ? ? ?{
? ? ? ? ? ? ? ? ?Console.WriteLine("有7的倍數(shù)");
? ? ? ? ? ? ?}
? ? ? ? ? ? ?else
? ? ? ? ? ? ? ?Console.WriteLine("沒有7的倍數(shù)");
哪里錯了?
2016-09-11
是<,不是<=,謝謝
2016-09-10
? ? ? ? ? ? //聲明整型數(shù)組,保存一組整數(shù)
? ? ? ? ? ? int[] num = new int[] { 3,34,43,2,11,19,30,55,20};
? ? ? ? ? ? //請完善代碼,判斷數(shù)組中有沒有7的整倍數(shù)
? ? ? ? ? ? foreach ( int x in num)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? if( x % 7 == 0)
? ? ? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? Console.WriteLine("有7的整倍數(shù)");
? ? ? ? ? ? ? ? ? ? return;
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
? ? ? ? ? ? Console.WriteLine("沒有7的整倍數(shù)");
? ? ? ? }