How do I keep arduino working after unplug

Hello, I'm new in this, I like to know how I keep the program in the arduino, because when I Upload the scketch to the arduino (arduino mega or uno) it works good! but then I unplug the arduino and plug it again and the program is gone! I need to upload the scketch again!! =S so, I need always a computer! and it must be always turning on! =S so, how I keep that scketch in the arduino and when I unplug and plug it with other kind of sourse power like a battery, the program runs??????

No that does not happen. Several people report this but in the end they always admit they are mistaken.

Maybe I don't explain myself... I mean, I upload a scketch and it works, when I unplug the arduino from the PC, and plug it again to the PC, the arduino doesn't do what I programmed anymore, it is like erased =S, I need to upload the scketch again and it works.

I like to know how I record that scketch in the arduino, and don't have this problem!!

Please! help! ='S

Where did you buy your Arduino from? Sounds like it has an old bootloader.

Maybe I don't explain myself

Yes you did. Maybe you did not understand my answer?

If code runs it is running from flash memory. This is non volatile memory and so is not lost when you remove the power. If you truly have this effect then your processor is hosed, but I have seen people here report this effect only later to find out they made a mistake.

dnnyau: I like to know how I record that scketch in the arduino, and don't have this problem!!

It can't run without being uploaded. It also doesn't erase itself. However there was a bug with one of the bootloaders where it would not exit to your program (so the sketch would seem to have gone) if it wasn't plugged into the USB ... or something.

I suggest upgrading the bootloader.