So what I'm trying to do is to make a histogram of the frequency of a, b, c, d, and others. I was wondering why when I give the program an input of say `abcde`, `other` is counted more than one time when `e` only occurs once. 

The output I'm looking for with input `abcde` is

```
 a:x
 b:x
 c:x
 d:x
 other:x

```

The actual *K&R* exercise is to print a histogram of the different characters that appear in an input. My code appears to be extremely inefficient, so I want to know if am I in the right direction to answering the exercise. Any guidance would be appreciated. The code is below.

```
#include <stdio.h>

main()
{
    int i, c, na, nb, nc, nd, nother;

    na = nb = nc = nd = nother = 0;

    while( (c = getchar()) != EOF ) {
        if(c == 'a')
            na++;
        if(c == 'b')
            nb++;
        if(c == 'c')
            nc++;
        if(c == 'd')
            nd++;
        else nother++;
    }

    printf("a:");
    for(i == 0; i < na; i++) {
        putchar('x');
    }

    printf("\nb:");
    for(i = 0; i < nb; i++) {
        putchar('x');
    }

    printf("\nc:");
    for(i = 0; i < nc; i++) {
        putchar('x');
    }

    printf("\nd:");
    for(i = 0;i < nc; i++) {
        putchar('x');
    }

    printf("\nother:");
    for(i = 0;i < nother; i++){
        putchar('x');
    }
}

```