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(" 范围内被7整除的个数为" +m); Console.ReadLine(); } } }