I am getting Wrong Answer on submitting the code;
Its working for sample test cases and also for custom created test case…
Getting WA on submitting
logic is correct
only few mistakes
-
use int instead of float because in question it is not mention to print ans in decimal
-
print output of each testcase in new line
use cout<<endl; after each testcase -
cin>>d this should be inside while loop while(n–){}
Modified code
if you have more doubts regarding this feel free to ask
i hope this helps
if yes hit a like
: and don’t forgot to mark doubt as resolved 
1 Like
Thank you 