aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--1-13_word-length-histogram.c9
-rw-r--r--1-21_entab.c1
2 files changed, 8 insertions, 2 deletions
diff --git a/1-13_word-length-histogram.c b/1-13_word-length-histogram.c
index 1b4cdc0..1e21378 100644
--- a/1-13_word-length-histogram.c
+++ b/1-13_word-length-histogram.c
@@ -52,8 +52,13 @@ int main(void) {
/* Everything that's input counts as a letter. */
++ltrs;
}
- // This is ugly and I wish I knew a better way to do it.
- printf("\nWORD LENGTH FREQUENCY\n\n 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75\n");
+
+ printf("\nWORD LENGTH FREQUENCY\n ");
+ for (i = 5; i < 80; i += 5) {
+ printf(" %2d", i);
+ }
+
+ printf("\n"); // End the chart heading.
int iter;
iter = MINWLENGTH;
while (iter <= MAXWLENGTH) {
diff --git a/1-21_entab.c b/1-21_entab.c
index 595f583..0f25706 100644
--- a/1-21_entab.c
+++ b/1-21_entab.c
@@ -42,4 +42,5 @@ int main(void) {
putchar(c);
}
}
+ return 0;
}