Ask Question
21 September, 08:09

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. 21 September, 08:29
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers