WA in CPRIME of spoj

The link to my code is http://ideone.com/7k3PsO
I am getting correct answer for all test case but still getting WA on spoj …please help me out…Thanks in advance

i am sorry but the ideone link you have given , shows wrong ans for the input you have supplied.
like for 2 your ans is inf and this is a sample test case with output 188.5 :confused:

Really sorry…I had written wrong link by mistake…But i have completed this question now.
Sorry and thanks

not a problem! :slight_smile: