Ask Question
8 September, 22:02

Find the error in the following pseudocode.

Module main ()

Declare Real mileage

Call getMileage ()

Display "You've driven a total of ", mileage, " miles."

End Module

Module getMileage ()

Display "Enter your vehicle's mileage."

Input mileage

End Module

+1
Answers (1)
  1. 9 September, 00:16
    0
    Following are the error in the given program are explain in the explanation part.

    Explanation:

    The main () function call the function getMileage () function after that the control moves to the getMileage () definition of function. In this firstly declared the "mileage" variable after that it taking the input and module is finished we see that the "mileage" variable is local variable i, e it is declared inside the " Module getMileage () " and we prints in the main module that are not possible to correct these we used two technique.

    Technique 1: Declared the mileage variable as the global variable that is accessible anywhere in the program.

    Technique 2: We print the value of "mileage" inside the Module getMileage () in the program.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Find the error in the following pseudocode. Module main () Declare Real mileage Call getMileage () Display "You've driven a total of ", ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers