# HP Forums

Full Version: Pitch vs Angle
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
The program PITCH calculates the pitch and angle of various roof heights. The pitch of a roof is the number of inches of vertical rise per 12 inches. For example: a roof of 3/12 is pitch is a roof that rises 3 inches for every 12 horizontal inches.

This program demonstrates the angle computer given different roof pitches. You control the rise, anywhere for 0.5 ft to 12 ft. Use the up and down arrow keys to control the rise.

To exit the program: Press [Esc].

Code:
```EXPORT PITCH() BEGIN // HP Prime, EWS 2061-09-21 Xmin:=−10;Xmax:=10; Ymin:=−10;Ymax:=10; LOCAL h,k,a,t,s1,s2; k:=0; h:=6; a:=HAngle; HAngle:=1; RECT(0); REPEAT k:=GETKEY; s1:="Pitch = "+h+"/12"; TEXTOUT(s1,−5,8,4,#7DF9FFh); LINE(−4,−4,4,−4,#FF00h); LINE(4,−4,4,−4+h,#EDC9AFh); LINE(−4,−4,4,−4+h,#FF00h); t:=ATAN(h/12); s2:="Angle = "+t+"°"; TEXTOUT(s2,−5,−8,4,#7DF9FFh); // UP IF k==2 AND h≠12 THEN RECT(0); h:=h+.5; END; // DOWN IF k==12 AND h≠.5 THEN RECT(0); h:=h-.5; END UNTIL k==4; // Esc RETURN "Done."; END;```
Reference URL's
• HP Forums: https://www.hpmuseum.org/forum/index.php
• :