Lab Question 2 Functions & recursive functions

Dependencies:   mbed

Revision:
0:c87e6041f68f
Child:
1:25616f0791d2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Apr 17 12:14:10 2021 +0000
@@ -0,0 +1,20 @@
+
+// Lab 2: Functions and recursive actions
+// John Curran T00214119
+
+
+#include "mbed.h"
+Serial pc(USBTX,USBRX);// serial communications
+
+int j=1, k=0, fib =0;
+
+int N = 10 ;
+
+int main() {
+    for (int count = 0; count < N; count ++ ) {
+        pc.printf (" %d, ",fib);
+        fib = k+j;
+        k=j;
+        j=fib;
+        }
+        }
\ No newline at end of file