Okay, then what you want requires a totally different plan. You need to manually parse each element of an array and see if it's a digit, if it is then you print it and if it isn't you break. I've written a little template for you to use, edit it however you need to to get the proper results.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
int main(void){
char department[10];
int done = 0, i = 0;
while(!done){
printf("\nEnter Department:");
fgets(department, sizeof(department), stdin);
while(isdigit(department[i])){
printf("%c",department[i]);
++i;
}
printf("\n");
done = 1;
}
return EXIT_SUCCESS;
}
-Prelude