Console.WriteLine("1-100以内所有不能被7整除的数");
int Count = 0;
int Sum = 0;
for (int i = 1; i <= 100; i++)
{
if (!(i % 7 == 0))
{
Count++;
Sum += i;
Console.Write("{0} ", i);
if (Count % 4 == 0)
{
Console.WriteLine("");
}
}
}
Console.WriteLine("和为:{0}", Sum);
Console.ReadKey();
网友评论