what is the most effective way to do sit-ups? how many should i do to get a flat stomach?

i was told the best way is raise your legs in the air while you do the crunches effectively forming a U shape, but i have found that resting my legs on a chair when i do the crunches is better for my back..but what is the best way???