Write a function to read a sequence of character digits and
Solution
#include <stdio.h>
 int getnum()
 {
    int ans=0;
    char c;
    printf(\"Enter a number(a space to end):\");
    //scanf(\"%c\",&c);
    int count=0;
    while(1)
    {
        scanf(\"%c\",&c);
        //printf(\"%c\ \",c);
        if(count==0 && c==\'\ \')
        {
            continue;
        }
        if(c==\' \')
        {
            break;
        }
        ans = ans*10+(c-\'0\');
        count++;
    }
    return ans;
 }
 int main()
 {
    printf(\"The value was: %d\ \",getnum());
    return 0;
 }

