Sayyiduna Mu'adh bin Jabal (may Allah be pleased with him) said: In the time of the Messenger of Allah (peace and blessings be upon him), the practice of the people was that when one of them had missed part of the prayer, he would ask them, and they would indicate to him by gesture what he had missed. He would first pray what he had missed, then join them in their prayer. Then Mu'adh (may Allah be pleased with him) came while the people were sitting in their prayer, so he sat with them. When the Messenger of Allah (peace and blessings be upon him) had concluded with the salam, he stood up and made up what he had missed. The Messenger of Allah (peace and blessings be upon him) said: "Do as Mu'adh bin Jabal has done."
Hadith Referenceالمعجم الكبير للطبراني / باب الميم / 17408