作业要求
代码
...
int sum = 0;
int n= 0;
Console.WriteLine("1-100之间不能被7整除的数据为:");
Console.WriteLine();
for (int i = 1; i <= 100; i++)
{
if (i % 7 == 0)
{
continue;
}
else
{
Console.Write(i + "\t");
sum += i;
n++;
if (n % 4 == 0)
{
Console.WriteLine();
}
}
}
Console.WriteLine();
Console.WriteLine();
Console.WriteLine("数据之和为:{0}",sum);
Console.ReadKey();
...
2018-12-26(1)
网友评论