Before attempting to reformat your computer, ensure you back up your important files. If your computer is running OS X, you can use the Disk Utility to reformat it. For Windows 7 and Windows Vista, you need the Windows Installation DVD.
For OS X, first ensure you are connected to the Internet. Go to the Apple menu, click Restart, and then press the Command and R keys while the computer reboots. Select Disk Utility, and then click Continue. From the list on the left side of the screen, select your startup disk, and then click Erase. Select Mac OS Extended from the Format pop-up menu, type a name from your disk, and then click Erase.
Next, select Disk Utility, and then click Quit Disk Utility. Select Reinstall Mac OS X, click on Continue, and then follow the instructions.
For Windows 7 or Vista, reboot the computer from the Installation DVD. After successfully booting from the DVD, select a language, click Next, accept the terms and conditions, and then select the Custom (advanced) installation. Select the partition you want to install Windows in, and then click Next. Wait for Windows to install in the selected partition. After the computer reboots having fully installed Windows, choose a user name and password, select the settings you prefer, and then set the date and time.