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 on_off =false ;
foreach (int x in num)
if(x%7==0)
{
on_off = true;
break;
}
if(on_off)
{
Console.Write("有7的整倍数");
}
else
{
Console.Write("没有7的整倍数");
}
}
}
}
foreach(int x in num) { if(x%7 == 0) { on_off = true; break; } if(on_off) { Console.Write("有7的整倍数"); } else { Console.Write("没有7的整倍数"); } }