Moved to C forum because it is a C program, not c++.
>>fflush(stdin);
Non-standard use of fflush(). There is no standard way to flush the input stream, and fflush() is only defined to flush output streams to the file on disk (e.g. your hard drive).