projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
[project @ 1996-01-11 14:06:51 by partain]
[ghc-hetmet.git]
/
ghc
/
misc
/
examples
/
nfib
/
nfib.c
diff --git a/ghc/misc/examples/nfib/nfib.c
b/ghc/misc/examples/nfib/nfib.c
new file mode 100644
(file)
index 0000000..
04e7d54
--- /dev/null
+++ b/
ghc/misc/examples/nfib/nfib.c
@@ -0,0
+1,16
@@
+#include <stdio.h>
+
+main ()
+{
+ int n;
+
+ scanf("%d",&n);
+ n = nfib(n);
+ printf("nfibs=%d\n",n);
+ exit(0);
+}
+
+nfib (n)
+{
+ return(n <= 1 ? 1 : nfib(n-1) + nfib(n-2) + 1);
+}