Console.WriteLine("1-100不能被7整除的有");
int line = 0;int sum=0;
for (int i = 1; i <= 100; i++)
{
if (i % 7 != 0)
{
line++;
Console.Write("{0}\t", i); sum = sum + i;
if (line % 4 == 0) { Console.WriteLine("\t"); }
}
else if (i % 7 == 0)
{
{ Console.Write(""); }
}
} Console.WriteLine("相加得{0}",sum);Console.ReadKey();
网友评论