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语句不成立时。
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语句不成立时。
相关文章推荐
- C#入门5.4——迭代语句之while语句
- C#中使用设置(Settings.settings) Properties.Settings.Default .
- C#友元程序集
- C#入门5.3——分支语句之三元运算符
- C#入门5.2——分支语句之switch语句
- C#入门5.1——分支语句之if语句
- 用dnlib合并两个dll内的同名类
- c# 结束进程树实现
- C# winform DataGridt将行中标记字段转换为要展示的字段名称 比如0,1转换为是或否
- C# winform datagrid 选中行的值
- C#泛型
- C#入门4.9——本章小结及任务实施
- C#入门4.8——运算符的优先级
- c#如何读取相机手机的拍摄时间
- C#入门4.7——其他运算符
- c# datatable删除一行
- C#入门4.6——位运算符
- C#实现将商品金额小写转换成大写的方法
- 输入验证
- C#小数点格式化用法小结