How about treating us seriously? Shall I begin to list why your code sucks?
- You use gets() like I told you not to.
- You open the input file for writing.
- You write to the input file.
- You only close one file.
- You didn't even read the documentation on toupper().
- Your indentation sucks.
That might be a good starting place for you to start fixing things. Your code shouldn't even compile in its current form.