Compile a program to count the numbers, spaces, and the number of occurrences of all other characters in the input string.
# Include <stdio. h> int main () {char a = 0; int num_count = 0; int space_count = 0; int other_count = 0; // note that a = getchar () cannot be written here (), then while (! = '\ N'). In this case, only one row can be input, and an endless loop while (a = getchar () is performed ())! = '\ N') {if (a> = '0' & a <= '9') {num_count ++;} else if (a = '') {space_count ++;} else {other_count ++;} printf ("num_count = % d \ n", num_count); printf ("space_count = % d \ n ", space_count); printf ("other_count = % d \ n", other_count); return 0;} another method ---- call the function: # include <stdio. h> # include <ctype. h> // checks the white space and calls the isspace () function. Therefore, you must call the int main () {char str [20] header file. // This field limits int num_count = 0; int space_count = 0; int other_count = 0; char * p = str; gets (str ); // receives the string while (* p) {if (* p> = '0' & * p <= '9') {num_count ++ ;} else if (isspace (* p) // use the isspace function to determine whether it is a blank character {space_count ++;} else {other_count ++;} p ++ ;} printf ("num_count = % d \ n", num_count); printf ("space_count = % d \ n", space_count); printf ("other_count = % d \ n ", other_count); return 0 ;}