Itunes/ipod keep songs with formatt pc?

hey guys one of my friends had all thier songs on thier ipod and formatted thier computer and then when she installed itunes it synced and her ipod had 0 songs lol soo im planning to format and i have a good 400 songs i dont want to loose so is there a way around this?