[ create a new paste ] login | about

Link: http://codepad.org/DKsiQe91    [ raw code | output | fork ]

grhegde09 - C, pasted on Nov 3:
main()
{
    int i = 0,j=0,count[26]={0};
    char ch = 97;
    char string[100]="quick brown fox jumps over lazy dog";
    for (i = 0; i < 100; i++)
    {
        for(j=0;j<26;j++)
            {
            if (tolower(string[i]) == (ch+j))
                {
                    count[j]++;
                }
        }
    }
    for(j=0;j<26;j++)
        {

            printf("\n%c -> %d",97+j,count[j]);

    }

}


Output:

a -> 1
b -> 1
c -> 1
d -> 1
e -> 1
f -> 1
g -> 1
h -> 0
i -> 1
j -> 1
k -> 1
l -> 1
m -> 1
n -> 1
o -> 4
p -> 1
q -> 1
r -> 2
s -> 1
t -> 0
u -> 2
v -> 1
w -> 1
x -> 1
y -> 1
z -> 1
Exited: ExitFailure 7


Create a new paste based on this one


Comments: