stephen reidy
/
lab2_fib_complete
Fib , lab2 complete
Revision 0:f20f7680069b, committed 2021-04-28
- Comitter:
- stephensv650
- Date:
- Wed Apr 28 09:47:02 2021 +0000
- Commit message:
- Stephen Reidy, Lab 2 complete
Changed in this revision
diff -r 000000000000 -r f20f7680069b C12832.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/C12832.lib Wed Apr 28 09:47:02 2021 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/chris/code/C12832/#7de323fa46fe
diff -r 000000000000 -r f20f7680069b main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Apr 28 09:47:02 2021 +0000 @@ -0,0 +1,21 @@ +#include "mbed.h" // Stephen Reidy; lab2 + +int j=1, k=0, fib=0; // Integers initialised +int N = 10; // Integers initialised + +int fibb(int inp) +{ + if (inp == 0) // if statemant to return 0 + return 0; + else if (inp == 1) // else if statemant to return 1 + return 1; + else // else to return fibb calculation + return (fibb(inp -1) + (inp -2)); +} + +int main() //Main structure +{ + for (int i=0; i<10; i++) //for loop, including conditions + printf("%d, ", fibb(i)); //fibb printout (i), PC (Tera term) + printf("\r\n"); +}
diff -r 000000000000 -r f20f7680069b mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Apr 28 09:47:02 2021 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file