当前位置:网站首页>C output Fibonacci sequence
C output Fibonacci sequence
2022-07-23 12:59:00 【Amateur visionary】
One 、 What is Fibonacci series
Fibonacci sequence (Fibonacci sequence), Also called golden section series 、 Because mathematician Leonardo · Fibonacci (Leonardoda Fibonacci) Take rabbit breeding as an example , It is also called “ Rabbit Series ”
Two 、 Fibonacci sequence definition :
Simply speaking , Fibonacci sequence refers to a sequence like this 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89…
That is, the sequence from the first 3 A start , Each of these terms is equal to the sum of the first two terms .
3、 ... and 、 Use C# Realization of Fibonacci series
When we fully understand the definition of Fibonacci sequence , Then it can be implemented in programming language ( Sample selection C# Realize the output Fibonacci sequence , And press 5 That's ok 4 Column mode output )
using System;
namespace fibonacci
{
class Program
{
static void Main(string[] args)
{
int a = 1;
int b = 1;
int c = 0;
Console.WriteLine(" Fibonacci sequence :");
for(int i=1; i<=5; i++)
{
for (int j=1; j<= 4; j++)
{
Console.Write("{0}\t", a);
c = a + b;
a = b;
b = c;
}
Console.WriteLine();
}
Console.ReadKey();
}
}
}
边栏推荐
- Hcip --- condition matching and OSPF Protocol
- 学习日记——(路由与交换技术)网络地址转换 NAT技术
- Unity3d: special effect object pool, timeout delete GameObject in the pool, GC weight
- Gameframework:resource loading, resource loading, dependency loading, task pool, object pool, reference count
- C custom queue set
- Do a Cisco experiment!
- How far is the first kind of mistake from us
- How to solve too many if statements
- Unity mouse controls camera drag, rotation and zoom (simulation editor camera function)
- Article on the basic technology needed to build hybrid app
猜你喜欢

超好用的抓包工具tcpdump

Understanding of LSM tree (log structured merge tree)

Unity3d:ugui, UI and special effect particle level, bakemesh above 2018.2, particles between two images and in Scrollview

C (CSharp) wechat official account development - basic configuration

DHCP principle and configuration

C custom queue set

C language can also write Plants vs. Zombies

RIP 配置实例学习记录

OSPF comprehensive experiment in hcip-mgre environment

平方根立方根
随机推荐
Unity3d: special effect object pool, timeout delete GameObject in the pool, GC weight
Learning diary - (routing and switching technology) single arm routing
Telnet 配置实例学习记录
nfs服务部署笔记
Liveness、Readiness 和 Startup Probes
秘钥远程登录服务器实现免密登录实战
ACL 配置实例学习记录
0 dynamic planning leetcode1024. Video splicing
C: stack stack source code, array stack, chain stack
C custom set
Hcip --- OSPF details
es常见操作
RIP 配置实例学习记录
快速解决:Xshell拖不進去文件夾或者軟件包的問題
关于搭建Hybrid App所需要的基础技术一文
超好用的抓包工具tcpdump
Learning diary - (routing and switching technology) ACL access control list
Understand the article frankly and get the HTTP protocol cache
htpasswd作用
Pod 拓扑约束