您的位置:首页 > 编程语言 > C#

C#入门5.5——迭代语句之do...while语句

2016-08-04 15:10 190 查看
使用格式:

do

{

循环体语句;

}while(判断语句);

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication4
{
class Program
{
static void Main(string[] args)
{

int num = 1;
do //输出1-50
{
Console.WriteLine(num);
num++;
} while (num <= 50);
Console.ReadKey();
}
}
}
do...while循环至少执行一次,即使while语句不成立时。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: