Code: #include <conio.h> #include <stdio.h> main() { int a; printf ("Enter Number "); scanf ("%d",&a); printf ("Num is %d",a); getch(); return 0; } my problem is that my prof want me to disable inputing of dot (".") when I input data in scanf, somebody know how to do it? i think of having if statements if (a=='.') b=8;printf ("%c",b); where i want to set decimal 8 to ascii which is backspace; but it only execute when i enter during the scan,,
Use fgets to read a line of input from the user (use stdin as the file pointer). Then you can parse the input to your heart's content.