OpenCores
URL https://opencores.org/ocsvn/hf-risc/hf-risc/trunk

Subversion Repositories hf-risc

[/] [hf-risc/] [trunk/] [software/] [app/] [fib.c] - Rev 13

Compare with Previous | Blame | View Log

#include <hf-risc.h>
 
int fib(int n){
	int a = 0;
	int b = 1;
	int sum;
	int i, j;
	char str[32];
 
	for (i = n; i > 0; i--) {
		printf("%d ", a);
		sum = a + b;
		a = b;
		b = sum;
	}
 
	return 0;
}
 
int main(){
	fib(20);
	putchar('\n');
 
	return 0;
}
 
 

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.