可以運(yùn)行,也輸出了“沒(méi)有7的整數(shù)倍”,為什么不能通過(guò)?
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 has7 = false;
? ? ? ? ? ? foreach (int x in num)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? if (x % 7 == 0)
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? has7 = true;
? ? ? ? ? ? ? ? ? ? break;
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
? ? ? ? ? ? if (has7)
? ? ? ? ? ? ? ? Console.WriteLine("有7的整數(shù)倍");
? ? ? ? ? ? else
? ? ? ? ? ? ? ? Console.WriteLine("沒(méi)有7的整數(shù)倍");?
? ? ? ? }
? ? }
}
2019-07-20
是整倍數(shù)不是整數(shù)倍