Skip to content

Instantly share code, notes, and snippets.

@CapnKernel
Created September 28, 2013 00:37
Show Gist options
  • Select an option

  • Save CapnKernel/6737072 to your computer and use it in GitHub Desktop.

Select an option

Save CapnKernel/6737072 to your computer and use it in GitHub Desktop.
10 REM Length of hypotenuse of triangle
20 A=3
30 B=4
40 GOSUB 100
50 PRINT "A triangle with sides ", A, " and ", B, " has a hypotenuse of length ", C
20 A=5
30 B=12
40 GOSUB 100
50 PRINT "A triangle with sides ", A, " and ", B, " has a hypotenuse of length ", C
60 END
100 REM Calculate hypotenuse using Pythangorus' Theorem
110 C=SQRT(A*A+B*B)
120 RETURN
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment