First, if
is not a loop, it is a statement. There's only going to be one pass through the code.
That means the first line can read if c is a digit
and the second line combines conversion of the ascii digit to an integer digit (and increments the element of the n array to count that digit).