diff options
author | RossTheRoss <msattr@gmail.com> | 2019-02-20 19:29:06 +0000 |
---|---|---|
committer | RossTheRoss <msattr@gmail.com> | 2019-02-20 19:29:06 +0000 |
commit | 6af4165c7b2dae8240fb4a0c368a93b7d4f7eb96 (patch) | |
tree | a43dd80d67d9426ebb989e602bd9077a7009a6be /ee1301/wk3/lab3/fib.cpp | |
parent | FINISH 2B FINALLY (diff) | |
download | homework-6af4165c7b2dae8240fb4a0c368a93b7d4f7eb96.tar homework-6af4165c7b2dae8240fb4a0c368a93b7d4f7eb96.tar.gz homework-6af4165c7b2dae8240fb4a0c368a93b7d4f7eb96.tar.bz2 homework-6af4165c7b2dae8240fb4a0c368a93b7d4f7eb96.tar.lz homework-6af4165c7b2dae8240fb4a0c368a93b7d4f7eb96.tar.xz homework-6af4165c7b2dae8240fb4a0c368a93b7d4f7eb96.tar.zst homework-6af4165c7b2dae8240fb4a0c368a93b7d4f7eb96.zip |
MORE LABS
Diffstat (limited to 'ee1301/wk3/lab3/fib.cpp')
-rw-r--r-- | ee1301/wk3/lab3/fib.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/ee1301/wk3/lab3/fib.cpp b/ee1301/wk3/lab3/fib.cpp new file mode 100644 index 0000000..7508637 --- /dev/null +++ b/ee1301/wk3/lab3/fib.cpp @@ -0,0 +1,17 @@ +#include <iostream> +using namespace std; +int main() +{ + unsigned long long fib1=0, fib2=1, count, temp; + cout << "How many Fibonacci numbers should be computed? "; + cin >> count; + for (int i=1; i<(count+1); i++) { + temp=fib1+fib2; + fib1=fib2; + fib2=temp; + cout << temp << " "; + if (i%10==0 && i!=0) + cout << endl; + } + cout << endl; +}
\ No newline at end of file |