>printf("Enter Number :");
You should call fflush ( stdout ) after this. The stream buffer is only guaranteed to be flushed when it's full (which you can't portably determine), when a newline is printed (which you aren't doing for this prompt), or when fflush is called. If stdout isn't flushed before the scanf call, your user may not see the prompt.
You also need to include stdio.h. Your code presently exhibits undefined behavior.
scanf takes a pointer to int so that it can store the value in your variable. Because n isn't already a pointer, you need to pass the address of n. You should also be checking the return value of scanf in case the user can't type or follow instructions.
You need to include conio.h, but getchar is better because it's standard while getch is not.
Here's a better example:"
int main ( void )
printf ( "Enter Number: " );
fflush ( stdout );
if ( scanf ( "%d", &n ) == 1 )
printf ( "Hexadecimal Equivalent %x\n", n );
while ( getchar() != '\n' )
That makes sense. Borland likes to complain about unused results. You can safely ignore the warning (because getchar really does something here), or you can cast the result to void to silence the warning:
>The problem is solved by replacing getchar(); with getch();
Fine. Use getch then. It's not like I went out of my way to point out that getch is non-portable and offer a perfectly valid alternative. Oh wait, I did. I guess some people just insist on refusing to learn and doing stupid things. Next time I won't waste my time being so helpful.