try
{
Console.WriteLine("1~100之间不能被7整除的数据为:");
int sum = 0;
int count = 0;
for (int i = 1; i < 101; i++)
{
if (i % 7 != 0)
{
sum += i;
count++;
Console.Write(i+"\t");
if (count == 4)
{
Console.WriteLine();
count = 0;
}
}
}
Console.WriteLine("\n数据之和为:"+sum);
}
catch
{
Console.WriteLine("输入的成绩错误!!");
}
Console.ReadKey();
网友评论