为了账号安全,请及时绑定邮箱和手机立即绑定

请帮忙看看

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 has7 = false;

            for(int i=0;i<num.length;i++)

            {

                if(num[i] %7==0)

                {

                    has7 = true;

                    break;

                }

                if(has7)

                {

                    Console.Write("有7的整数倍");

                }

                else

                {

                   Console.Write("没有7的整数倍");  

                }

            }

        }

    }

}


正在回答

1 回答

把两行打印写在for循环外面就行

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
C#开发轻松入门
  • 参与学习       251349    人
  • 解答问题       1447    个

本门课程是C#语言的入门教程,将带你轻松入门.NET开发

进入课程

请帮忙看看

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信