Ask Question
24 July, 16:42

A file named numbers. txt contains an unknown number of lines, each consisting of a single positive integer. Write some code that reads through the file and stores the largest number read in a variable named maxvalue.

+3
Answers (1)
  1. 24 July, 16:46
    0
    Not a complicated task, but we really need to know which language. Pseudo code would be like:

    maxvalue = 0

    file = open ("numbers. txt", "rb")

    while (not EOF) : #End Of File

    file. readln (value)

    if (value > maxvalue):

    maxvalue = value

    file. close ()
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “A file named numbers. txt contains an unknown number of lines, each consisting of a single positive integer. Write some code that reads ...” 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