Advertisement
Guest User

13 c

a guest
Jan 17th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1.  
  2. LET Repeat$="Yes"
  3. DO While Repeat$= "Yes"
  4. PRINT
  5. PRINT "Choose which option you would like to see"
  6.  
  7. PRINT "1-Square"
  8. PRINT "2-Square Root"
  9. PRINT "3-Sum of all numbers"
  10. PRINT "4-Number of perfect squares"
  11.  
  12. PRINT "Type in the number of the option you would like to see"
  13. INPUT Choice
  14.  
  15. IF Choice =1 then CALL Square
  16. IF Choice =2 then CALL SquareRoot
  17. IF Choice =3 then CALL SumOfAllNumbers
  18. IF Choice =4 then CALL NumberOfPerfectSquares
  19.  
  20. PRINT
  21. INPUT prompt "Would you like to restart the program? ":Repeat$
  22. LOOP
  23.  
  24.  
  25. !__________________________________________________________
  26.  
  27. SUB Square
  28. PRINT "The List of Squares"
  29. FOR Number= 1 to 20
  30. PRINT Number;TAB(6);Number^2
  31. NEXT number
  32. END SUB
  33.  
  34. !__________________________________________________________
  35.  
  36. SUB SquareRoot
  37. PRINT "The List of Squares Roots"
  38. FOR Number= 1 to 20
  39. PRINT Number;TAB(6);Sqr(Number)
  40. NEXT number
  41. END SUB
  42.  
  43. !__________________________________________________________
  44.  
  45. SUB SumOfAllNumbers
  46.  
  47. FOR Number= 1 to 20
  48. LET Total=Total+Number
  49. NEXT number
  50. PRINT "The sum of all the numbers is";Total
  51. END SUB
  52.  
  53. !__________________________________________________________
  54.  
  55. SUB NumberOfPerfectSquares
  56.  
  57. FOR Number= 1 to 20
  58. LET Root=Sqr(Number)
  59. IF Root= IP(Root) Then LET CountR=CountR+1
  60. NEXT number
  61. PRINT "There are";CountR;"perfect square"
  62. END SUB
  63.  
  64. !__________________________________________________________
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71. END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement