I stumbled upon a problem while I was coding.
This works just fine when I enter a number, but when I enter a char for example "A", it just starts repeating "Write a number in interval [10,100]\n" infinitely. I tried to explain this to myself but I just couldn't come to a logical conclusion.Code:void main() { int n; do { printf("Write a number in interval [10,100]\n"); scanf("%d",&n); }while(n<10 || n>100); }
In my opinion n should be initialized with 65 and program should leave the loop and end.