Code:
printf("Enter a number greater than two:\t");
scanf("%d", &n);
getchar ();
Perhaps, you should write a proper function to clear off the input buffer, but not just using the getchar function to clear it. Since there might be more than one char until you reach EOF char, which needs to be cleared. Use the following function to clear the input buffer.
Code:
void Clear_Buffer( void )
{
int ch;
while( ( ch = getchar() ) != '\n' && ch != EOF );
}
And, try avoiding using scanf function.
ssharish