[C#]第30位数字是多少
2016-03-26 13:26
267 查看
/*问题描述:一系列数的规则如下:1 1 2 3 5 8……求第三十位数字是多少 */ using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { int x = 1, y = 1; int count = 2; while (count < 30) { int z = x + y; x = y; y = z; ++count; } Console.WriteLine("第30位的数值是:{0}", y); Console.ReadKey(); } } }
运行结果:
相关文章推荐
- C#第二次上机
- C#第一次上机
- C#中的OLEDB连接2
- C#制作视频播放器-player播放器组件
- C# 编写WCF简单的服务端与客户端
- c#单例模式3中写法
- C#扫盲之:String字符串的常用方法和冷知识
- C# .net 下拉框显示提示内容-【ComboBox】
- C#界面美工IrisSkin2+button美工
- 我为什么喜欢用C#来做并发编程
- C#Winform内存加载多条件查询数据
- C#程序层面的内存分页方法
- 记c# rabbitmq的使用
- C# Array操作
- C#知识点-GDI绘图
- C#-ArrayList
- C#6.0新特性的尝试
- c#处理xml
- C#读取xml文件
- C#基础:关键字和数据类型