I'm fairly new to C but I'm having a bit of trouble writing a program that takes user input. This is the bit of code I'm having trouble with:

```
int xPos, yPos;    
while(1)
{
        printf("Enter two integers: ");
        if(scanf("%d %d", &xPos, &yPos) == 2)
        {
            printf("success \n");
        }
        else
        {
            printf("fail");
        }

}

```

Example run through of what I want as is follows:

```
Enter two integers: 4 4
success
Enter two integers: 13
fail
enter two integers: sda asd
fail

```

and it'll just keep going

But what I get is:

```
Enter two integers: 4 4
success
Enter two integers: 13
5 (it goes onto a new line for me and I have to enter something else to make it keep going) 
fail
Enter two integers: sda asd
Enter two integers:Enter two integers:Enter two integers:Enter two integers:Enter two integers:Enter two integers:Enter two integers:Enter two integers:Enter two integers:Enter two integers:Enter two integers: and on and on.. you get the idea.

```

Any hints as to what I'm doing wrong? I want it to scanf as soon as the enter button is hit.