Created
April 10, 2013 23:14
-
-
Save seyDoggy/5359273 to your computer and use it in GitHub Desktop.
PSPC Final Exam
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Problem Solving and Programming Concepts | |
Adam Merrifield (2697795). | |
Final Exam | |
################################ | |
start | |
GetResponse() | |
stop | |
num prompt(string msg) | |
Declarations | |
num userNumber | |
output msg | |
input userNumber | |
return userNumber | |
num integerPower(num valueA, num valueB) | |
Declarations | |
num base = valueA | |
num exp = valueB | |
while(exp > 1) | |
base = base * base | |
exp = exp - 1 | |
endwhile | |
return base | |
GetResponse() | |
Declarations | |
num QUIT = 0 | |
string messageA = "Please enter the base value (" QUIT " to quit) --> " | |
string messageB = "Please enter the exponent value (" QUIT " to quit) --> " | |
num base = prompt(messageA) | |
num exp = prompt(messageB) | |
while (base != QUIT && exp != QUIT) | |
result = integerPower(base, exp) | |
output base " to the power of " exp " is " result | |
base = prompt(messageA) | |
exp = prompt(messageB) | |
endwhile | |
return void |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment