Getting WA on submitting

I am getting Wrong Answer on submitting the code;
Its working for sample test cases and also for custom created test case…

logic is correct

only few mistakes

  1. use int instead of float because in question it is not mention to print ans in decimal

  2. print output of each testcase in new line
    use cout<<endl; after each testcase

  3. 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 :heart:: and don’t forgot to mark doubt as resolved :grinning:

1 Like

Thank you :slight_smile: