The correct answer is: C. he was advised by the doctor to lose weight.

The sentence is in the passive voice. The active voice would be: The doctor advised the patient to lose weight.

In the passive voice, the subject of the sentence is acted upon by the verb. In this case, the patient is acted upon by the verb "to advise." The patient is the one who is losing weight, so he is the subject of the sentence. The verb "to advise" is in the passive voice, so it is preceded by the preposition "by." The doctor is the one who is doing the advising, so he is the object of the preposition "by."

The other options are incorrect because they do not agree with the subject and verb of the sentence. In option A, "lose weight" is the subject of the sentence, but it is not in the passive voice. In option B, "to lose weight" is the object of the preposition "to," but it is not in the passive voice. In option D, there is no error, but it is not the most concise or correct way to write the sentence.