#include \"stdafx.h\" #include void main() { char buffer[20]; int num; printf(\"Please enter a number\\n\"); fgets(buffer, 20, std
There is the isdigit function that can help you check each character:
isdigit
#include /* ... */ for (i=0; buffer[i]; i++) { if (!isdigit(buffer[i])) { printf("Bad\n"); break; } }