( I hit enter)
#include<stdio.h>
#include<stdlib.h>
int main(){
    int target,result;
    while(1){
        printf("Please input your target: ");
        scanf(" %d",&target);
        if(feof(stdin)){
            break;
        }
        printf("test\n");       
    }
}
if I chnage the code to: (delete the space)
#include<stdio.h>
#include<stdlib.h>
int main(){
    int target,result;
    while(1){
        printf("Please input your target: ");
        scanf("%d",&target);//no space
        if(feof(stdin)){
            break;
        }
        printf("test\n");       
    }
}
it worked


 
    