Ask Question
18 October, 23:41

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

+5
Answers (1)
  1. 19 October, 02:51
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers