您的位置:首页 > 其它

200之内被7整除的数

2015-08-05 20:37 260 查看
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication58
{
class Program
{
static void Main(string[] args)
{
int n, m = 0;
try
{
do
{
Console.Write("输入一个7~200之间的任意数字");
n = int.Parse(Console.ReadLine());
}
while (n < 7 || n > 200);
Console.WriteLine("范围内能被7整除的数依次为");
for (int i = 7; i <= n; i++)
{
if (i % 7 == 0 )
{
Console.Write( i + "");
m++;
}
}

}

catch
{
Console.WriteLine("输入有误");
}
if (m == 0)
Console.Write("范围内没有被7整除的数");
Console.Write("\n范围内被7整除的个数为" +m);

Console.ReadLine();

}
}
}


  

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: