From 5474f7b679879edb05fb03452886dedff8e27f36 Mon Sep 17 00:00:00 2001 From: zlg Date: Thu, 29 Nov 2012 12:02:35 -0600 Subject: Correct 1-13's chart heading Thanks to ##c's rizlah --- 1-13_word-length-histogram.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to '1-13_word-length-histogram.c') 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) { -- cgit v1.2.3-54-g00ecf