Write an algorithm to delete the fifth record in a master file of 50 records stored on magnetic tape.

To delete the fifth record in a master file stored on magnetic tape, you can follow the steps below:

1. Initialize a counter variable, `recordCount`, to keep track of the number of records processed.
2. Open the master file on the magnetic tape for reading and the output file on the magnetic tape for writing.
3. While there are still records in the master file:
a. Read a record from the master file.
b. If `recordCount` is equal to 5, skip writing this record to the output file because it needs to be deleted.
c. Otherwise, write the record to the output file.
d. Increment `recordCount` by 1.
4. Close both the master file and the output file.
5. Delete the old master file from the magnetic tape.
6. Rename the output file to the same name as the original master file.

Here is a pseudocode representation of the algorithm:

recordCount = 1
open masterFile for reading
open outputFile for writing

while not endOfFile(masterFile) do
record = readRecord(masterFile)

if recordCount = 5 then
continue // Skip writing this record to delete it
writeRecord(outputFile, record)

recordCount = recordCount + 1
end while

close masterFile
close outputFile

delete masterFile from magnetic tape
rename outputFile to masterFile

Note: The exact implementation of the file operations may vary depending on the programming language and platform you are using.