Is there any other method to clear the input buffer in c withut using
fflush();
or
while(getchar()!=\'\\n\'); <
while(getchar()!=\'\\n\');
The best solution is to not depend on the input buffer's state so much.
Read input as whole lines, using fgets(), then parse those. Don't use e.g. scanf() to read individual values, since it interacts with the buffer in annoying ways.
fgets()
scanf()