POWER OF PRAYER H 436 "A man came to the Prophet, praise and peace be upon him, and said: 'O Messenger of Allah, I have committed a sin which is punishable. Please punish me.' It was the time for the prayer so the man prayed behind the Prophet, praise and peace be upon him, When the prayer was over he asked the Prophet, praise and peace be upon him, again: 'O Messenger of Allah, praise and peace be upon him, I have sinned, please punish me!' The Prophet, praise and peace be upon him, asked him: "Did you pray with us?" He replied: "Yes." So the Prophet, praise and peace be upon him, said, 'Then you have been forgiven.'" R 436 Bukhari and Muslim with a chain up to Anas who related this hadith
435- وعن أنس رضي الله عنه ، قَالَ: جاء رجل إِلَى النَّبيّ صلى الله عليه وآله وسلم ، فَقَالَ : يَا رَسُول الله، أَصَبْتُ حَدّاً ، فَأَقِمْهُ عَلَيَّ ، وَحَضَرَتِ الصَّلاةُ ، فَصَلَّى مَعَ رَسُول الله صلى الله عليه وآله وسلم ، فَلَمَّا قَضَى الصَّلاةَ ، قَالَ : يَا رَسُول الله ، إنِّي أصَبْتُ حَدّاً فَأقِمْ فيَّ كِتَابَ الله . قَالَ : "هَلْ حَضَرْتَ مَعَنَا الصَّلاةَ" ؟ قَالَ : نَعَمْ . قَالَ : "قَدْ غُفِرَ لَكَ" مُتَّفَقٌ عَلَيهِ .