Home > php教程 > php手册 > php实现斐波那契数列的简单写法

php实现斐波那契数列的简单写法

WBOY
Release: 2016-06-06 20:20:06
Original
2310 people have browsed it

这篇文章主要介绍了php实现斐波那契数列的简单写法,需要的朋友可以参考下

斐波那契数列是非常常见的一类数列,,其数学定义为:F0=1,F1=1,Fn=F(n-1)+F(n-2)(n>=2,n∈N*)。本文就用php来简单实现斐波那契数列,代码十分简洁易懂,如下所示:

至此就实现了Fn=F(n-1)+F(n-2)中n在100以内的斐波那契数列的显示输出。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template