Az-Zumar - 39:49

فَإِذَا مَسَّ الْإِنسَانَ ضُرٌّ دَعَانَا ثُمَّ إِذَا خَوَّلْنَاهُ نِعْمَةً مِّنَّا قَالَ إِنَّمَا أُوتِيتُهُ عَلَى عِلْمٍ بَلْ هِيَ فِتْنَةٌ وَلَكِنَّ أَكْثَرَهُمْ لَا يَعْلَمُونَ
[39:49]
So when harm afflicts a man he calls upon Us; then, when We give him a favor from Us, he says: I have been given it only by means of knowledge. Nay, it is a trial, but most of them do not know.
Now, when trouble touches man, he cries to Us: But when We bestow a favour upon him as from Ourselves, he says, "This has been given to me because of a certain knowledge (I have)!" Nay, but this is but a trial, but most of them understand not!
Now when hurt toucheth a man he crieth unto Us, and afterward when We have granted him a boon from Us, he saith: Only by force of knowledge I obtained it. Nay, but it is a test. But most of them know not.