Focus on <word> counting, garbage and error happens when <word> is 0.
When calculating `avg = letter / word;`
Print value of <letter> and <word> before calculating <avg> to see if it makes a valid/logical calculation.
The test for alphabets at line 12 still need correction, do as follows:
if ((s[i] >= 'a' && s[i] <= 'z') || (s[i] >= 'A' && s[i] <= 'Z'))
s[i]!='\0' causing that..
Instead of that use like i<strlen(s).
And use one float or double variable for word or char...
If both are Integer then int/int, you get again Integer value.. So you miss fraction part.
And in loop, s[i] <= 'z' not > greater than..
Same in next comparition...
Check out these...