main module Module main() // Local variables Declare Integer num1, num2, sum, answer // Get numbers Set num1 = random(1, 100) Set num2 = random(1, 100) Set sum = getSum(num1, num2) // Get user answer Call getAnswer(answer) // display result Call showResult(sum, answer) End Module // The getAnswer module gets user answer Module getAnswer(Integer Ref inputAnswer) Display “Enter sum of numbers: “ Input inputAnswer End Module // The showResult module tells if user answer is correct or not Module showResult (Integer sum, answer) If sum == answer Then Display "Correct answer – Good Work!" Else Display "Correct answer is: ", sum End If End Module // The getSum function adds 2 numbers. Function Integer getSum(Integer num1, num2) Declare Integer result Set result = num1 + num2 Return result flowchart for this please
// main module
Module main()
// Local variables
Declare Integer num1, num2, sum, answer
// Get numbers
Set num1 = random(1, 100)
Set num2 = random(1, 100)
Set sum = getSum(num1, num2)
// Get user answer
Call getAnswer(answer)
// display result
Call showResult(sum, answer)
End Module
// The getAnswer module gets user answer
Module getAnswer(Integer Ref inputAnswer)
Display “Enter sum of numbers: “
Input inputAnswer
End Module
// The showResult module tells if user answer is correct or not
Module showResult (Integer sum, answer)
If sum == answer Then
Display "Correct answer – Good Work!"
Else
Display "Correct answer is: ", sum
End If
End Module
// The getSum function adds 2 numbers.
Function Integer getSum(Integer num1, num2)
Declare Integer result
Set result = num1 + num2
Return result
flowchart for this please
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images