当前位置:网站首页>Finding the value of the nth term of Fibonacci sequence by recursion
Finding the value of the nth term of Fibonacci sequence by recursion
2022-06-22 23:17:00 【Xiaomurong】
Find... By recursion Fibonacci Sequence number n Item value . This series has the following characteristics : The first 1 Number and number 2 All of them are 1, From 3 Number of openings , Each number is the sum of its first two numbers .
#include <stdio.h>
unsigned Fib(unsigned n)
{
if(n>2)
return Fib(n-1)+Fib(n-2);
else
return 1;
}
int main(void)
{
unsigned n,ret;
puts(" Please enter Fibonacci The first n term :");
scanf("%d",&n);
ret=Fib(n);
printf("Fib The first %d Items for :%d\n",n,ret);
return 0;
}
边栏推荐
猜你喜欢

口令安全是什么意思?等保2.0政策中口令安全标准条款有哪些?

How to continuously improve performance| DX R & D mode

2021-08-21

AutoCAD - five annotation shortcuts

Generate detailed API and parameters of QR code using qrcodejs2

2021-04-14

Ensure database and cache consistency

Common operations of sourcetree version management

Spark RDD Programming Guide(2.4.3)

C sqlsugar, hisql, FreeSQL ORM framework all-round performance test vs. sqlserver performance test
随机推荐
Case 2 of SQL performance degradation caused by modifying implicit parameters
ArcGIS应用(二十)Arcgis 栅格图像符号系统提示“This dataset does not have valid histogram required for classificati…”
c# sqlsugar,hisql,freesql orm框架全方位性能测试对比 sqlserver 性能测试
js读取剪切板的图片
2020-12-20
安装typescript环境并开启VSCode自动监视编译ts文件为js文件
js图片分辨率压缩
Spark RDD Programming Guide(2.4.3)
2021-05-02
2021-08-26
Practice brings true knowledge: the strongest seckill system architecture in the whole network is decrypted. Not all seckills are seckills!!
LeakCanary 源码详解(2)
2021-04-16
Solution to cache inconsistency
【22暑期复建1】 Codeforces Round #791 (Div. 2)
Considerations for using redisson to operate distributed queues
使用HBuilder X编辑器安装终端窗口插件未响应的解决方案
Which securities company is the safest and best choice for stock trading account opening
Greedy distribution problem (2)
企业数字化不是各自发展,而是全面SaaS化推进