If you have a 40-foot wide barn and you want a simple roof, the rafters would be 40-feet wide. Each half would rise 6-feet for every 12-feet of width. There would be 20-feet from the edge to the middle so the peak would be 10-feet above the wall.
Other pitches are possible.
Some barns have two slopes - a steep part (12:12) on the bottom and a not so steep part on top (4:12). This allows a large loft without letting the roof get wayyyy high up in the sky.
So, what's your question?