Ask Question
16 November, 04:54

The following code processes a file containing five positive numbers. What will the variable $result contain after the code is executed? Be careful! $result = 0; $someFile = fopen ("some-file. txt", "r"); for ($count = 1; $count < = 5; $count = $count + 1) { $nextNum = fgets ($someFile); } $result = $result + $nextNum; fclose ($someFile); print ("The result is $result ");

+3
Answers (1)
  1. 16 November, 05:23
    0
    highest of five numbers in the file

    Explanation:

    This code reads the file "some-file. txt" and saves the result in variable "somefile" The runs a for loop for a count of 5. In each loop it compares the current value of the file with the value of the variable result and if the result is true it updates the value of the variable result. At the end of this code the variable result will contain the highest value in the file "some-file. txt" and print it.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “The following code processes a file containing five positive numbers. What will the variable $result contain after the code is executed? Be ...” 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