Consider the following simple C program.
//C test #include int main() { int a, b, c; printf(\"Enter two numbers to add\\n\"); scan
Also you can do this to prevent anything after second number
int a,b; char c; if( scanf("%d%d%c", &a, &b, &c) == 3) { if (c == '\n') { puts("good"); } } else { puts("bad"); } return 0; }