scanf не будет потреблять\n, поэтому он будет приниматься с помощью gets, следующего за scanf. запустите поток ввода после scanf, как это.
#include <stdlib.h>
#include <string.h>
int main(void) {
int a;
char b[20];
printf("Input your ID: ");
scanf("%d", &a);
fflush(stdin);
printf("Input your name: ");
gets(b);
printf("---------");
printf("Name: %s", b);
system("pause");
return 0;
}