using System;
using System.Collections.Generic;
using System.Text;
namespace 循环中断计算
{
class Program
{
static void Main(string[] args)
{
int sum = 0;
int i = 1;
while (i <= 100)
{
if (i % 7 == 0) //利用"取余"来验证当前i是否能被7整除,如果能整除余数为0;
{
i++;
continue; //continue之前要自增,contiue不会执行后面代码,直接跳到while中
}
sum = sum + i;
i++;
}
Console.WriteLine("{0}", sum);
Console.ReadKey();
}
}
}