用C斐波纳契数列 [英] Fibonacci Sequence in C

查看:86
本文介绍了用C斐波纳契数列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是预期的输出结果:

我们是做计算该斐波纳契数列的C程序。
我们只允许最多3个变量,我们不会允许使用循环。
我不知道做什么和如何下手。

We are to make a C program that calculates for the Fibonacci Sequence. We're only allowed up to 3 variables and we're NOT allowed to use loops. And I don't know what to do and how to start.

我希望你们能帮助我。 :/

I hope you guys can help me. :/

推荐答案

在你使用的是32位无符号整数的假设,第48 Fibonacci数将导致整数溢出。这使得它完全可行的使用一个查找表pcalculated(手)所有的值$ P $。

On the assumption that you are using 32 bit unsigned integers, the 48th Fibonacci number will cause an integer overflow. That makes it perfectly feasible to use a lookup table with all the values precalculated (by hand).

这篇关于用C斐波纳契数列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆