summaryrefslogtreecommitdiff
path: root/wk1/lab
diff options
context:
space:
mode:
Diffstat (limited to 'wk1/lab')
-rw-r--r--wk1/lab/population.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/wk1/lab/population.c b/wk1/lab/population.c
new file mode 100644
index 0000000..0ade623
--- /dev/null
+++ b/wk1/lab/population.c
@@ -0,0 +1,25 @@
+#include <cs50.h>
+#include <stdio.h>
+
+int main(void)
+{
+ int n;
+ do
+ {
+ n = get_int("Start size: ");
+ }
+ while (n < 9);
+ int end;
+ do
+ {
+ end = get_int("End size: ");
+ }
+ while (end <= n);
+ int year = 0;
+ while (n < end)
+ {
+ int c = (float) n + (n / 12);
+ year++;
+ }
+ printf("%d Years: %i\n", n, year);
+}