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 };
//请完善代码,判断数组中有没有7的整倍数
bool hasNub = false;
for (int i = 0; i <= num.Length; i++)
{
if (num[i] % 7==0)
{
hasNub = true;
break;
}
else
{
continue;
}
}
if (hasNub)
{
Console.WriteLine("有7的整数倍");
}
else
{
Console.WriteLine("没有7的整数倍");
}
}
}
}
慕尼黑0172299
慕前端0648451
相关分类