fib.c

来自「FPGA RSIC CPU设计文档和源码是EDA中对CPU设计非常好用的程序」· C语言 代码 · 共 21 行

C
21
字号
/* fib.c -- find largest Fibonacci sequence number less than N
 *
 * Copyright (C) 2000, Gray Research LLC.  All rights reserved.
 * The contents of this file are subject to the XSOC License Agreement;
 * you may not use this file except in compliance with this Agreement.
 * See the LICENSE file.
 */

enum { N = 10000 };

int main() {
	int a = 1, b = 1, c = 1;

	while (c < N) {
		c = a + b;
		a = b;
		b = c;
	}
	return a;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?