thanks for reply...
as u said-"scanf and family are best used when the exact input format is completely known".
in my case the format is already known and it is char type.and still it goes crazy..instead when i used int type then my program is all perfect.
and thanks for giving me another way to take the user input..
thanks again..