Card initialization failed

I am new to Arduino usage. I was trying to use an sd card to log my data. After wiring, i tried to compile the sketch from File-Examples-SD-cardInfo. there was no error and it displayed all good. Then i tried to run the read/write example. This time it did not run, it showed card initialization failed.
I am using CS pin as 10. I formatted the sd card by inserting in my laptop

I would go with the SdFat library, it's an up to date version of the Arduino SD library

it also has an SdFormatter sketch that will let you format your SD directly from the Arduino

Hello!

SD read/write example uses pin 4 as CS. Look at it:

if (!SD.begin(4))

If you´re using pin 10 as CS (which is the standard for UNO), simply change this line to

if (!SD.begin())