My program can either accept a number of any length or empty input. However, if the input is empty (space or newline), the program continues to wait for an input. I also tried `fgets` but if space/newline is pressed, it still waits for more input that is not a space/newline before closing.

Simpified code:

```
#include <stdio.h>
main()
{
    int num;
    scanf("%i",&num);
    printf("%i",num);
}

```

Input:

```
363792 

```

Output:

```
363792

```

Desired: 

Input:

Output:

I'm new to *C* and am having a very hard time accomplishing this.

What tried using fgets:

```
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
main()
{
    int n;
    char s[20];

    fgets(s,20,stdin);
    n = atoi(s);

    printf("%i",n);
}

```

Edit: Turns out I was not compiling the code right. So every time I tried to make changes, it just looked at the original code using scanf.