当前位置:网站首页>Function: find the approximate value of the limit of the ratio of the former term to the latter term of Fibonacci sequence. For example, when the error is 0.0001, the function value is 0.618056.
Function: find the approximate value of the limit of the ratio of the former term to the latter term of Fibonacci sequence. For example, when the error is 0.0001, the function value is 0.618056.
2022-07-04 00:40:00 【CTGU-Yoghurt】
subject :
First, explain what Fibonacci sequence is :
( Here I quote a picture written by a friend of mine )

In a nutshell
The first 1 Xiang and di 2 Items for 1, Starting from the back, each item is the sum of the first two items .
A sequence of numbers formed by analogy .
Code details :
#include <stdio.h>
#include "math.h"
float fun()
{
/**********Program**********/
float f1 = 1, f2 = 1,f3=2,t;//
f1 On behalf of the 1 term ,f2 On behalf of the 2 term ,f3 On behalf of the 3 term
while (fabs(f2/f3 - f1/f2) > 0.0001) {
f1 = f2;
t = f2 + f3;
f2 = f3;
f3 = t;
}
return f2/f3;// Method 1
/*float f1 = 1, f2 = 1, f3;
float r1 = 2, r2;
do
{
r2 = r1;
r1 = f1 / f2;
f3 = f1 + f2;
f1 = f2;
f2 = f3;
} while (fabs(r1 - r2) > 1e-4);
return r1;*/// Method 2
/********** End **********/
}
int main()
{
printf("y=%f\n", fun());
}
PS: Happy holidays happy holidays happy holidays happy holidays happy holidays happy holidays happy holidays happy holidays happy holidays happy holidays happy holidays happy holidays happy holidays happy holidays happy holidays happy holidays
边栏推荐
- Interview script of Software Test Engineer
- 不得不会的Oracle数据库知识点(一)
- Regular expression of shell script value
- 功能:求出菲波那契数列的前一项与后一项之比的极限的 近似值。例如:当误差为0.0001时,函数值为0.618056。
- Several ways to set up a blog locally [attach relevant software download links]
- [prefix and notes] prefix and introduction and use
- What insurance products should be bought for the elderly?
- Windos10 reinstallation system tutorial
- Pair
- 基于.NetCore开发博客项目 StarBlog - (14) 实现主题切换功能
猜你喜欢

(Introduction to database system | Wang Shan) Chapter V database integrity: Exercises

Generic

NLP pre training technology development
![[C language] break and continue in switch statement](/img/ae/5967fefcf3262c9d3096e5c7d644fd.jpg)
[C language] break and continue in switch statement

Is it really possible that the monthly salary is 3K and the monthly salary is 15K?

Windos10 reinstallation system tutorial

Shell script three swordsman sed
![[NLP] text classification still stays at Bert? Duality is too strong than learning framework](/img/49/1ff6025bdb0445e5638c1451e0b267.jpg)
[NLP] text classification still stays at Bert? Duality is too strong than learning framework

Cannot build artifact 'test Web: War expanded' because it is included into a circular depend solution

What is regression testing? Talk about regression testing in the eyes of Ali Test Engineers
随机推荐
Sequence list and linked list
Is it really possible that the monthly salary is 3K and the monthly salary is 15K?
Global and Chinese market of melting furnaces 2022-2028: Research Report on technology, participants, trends, market size and share
Gauss elimination method and template code
On covariance of array and wildcard of generic type
BBS forum recommendation
Is the low commission link on the internet safe? How to open an account for China Merchants Securities?
Qtcharts notes (V) scatter diagram qscatterseries
NLP pre training technology development
[software testing] you haven't mastered these real interview questions of big companies?
网上的低佣金链接安全吗?招商证券怎么开户?
Detailed explanation of the relationship between Zhongtai, wechat and DDD
不得不会的Oracle数据库知识点(四)
Cannot build artifact 'test Web: War expanded' because it is included into a circular depend solution
Solution to the impact of Remote Code Execution Vulnerability of log4j2 component on December 9, 2021
Cloud dial test helps Weidong cloud education to comprehensively improve the global user experience
Global and Chinese market of breast cancer imaging 2022-2028: Research Report on technology, participants, trends, market size and share
Global and Chinese markets for blood and liquid heating devices 2022-2028: Research Report on technology, participants, trends, market size and share
删除所有值为y的元素。数组元素中的值和y的值由主函数通过键盘输入。
Att & CK actual combat series - red team actual combat - V