所有栏目 | 云社区 美国云服务器[国内云主机商]
你的位置:首页 > 云社区 » 正文

C#怎么设置while循环每一秒循环一次并统计次数?

发布时间:2020-04-15 16:50:34

资讯分类:每一秒  while  次数  设置  休眠  中断  循环
C#怎么设置while循环每一秒循环一次并统计次数?

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace 中断循环

{

class Program

{

static void Main(string[] args)

{

//100以内符合i%7==0 || i%10==7||i/10==7条件的,统计次数一次

int i = 0;

int number=0;

while (i

{

i++;

if(i%7==0 || i%10==7||i/10==7)

{

number++;

System.Threading.Thread.Sleep(1000); // 让程序休眠一秒

continue;

}

Console.WriteLine("{0}

留言与评论(共有 0 条评论)
   
验证码:
Top