In hackerblock question i.e Square Root To Precision

Please correct my code, why only two test case passes out of 4.
here is my code:- (i ignored hash)

(hash tag) include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
double c = sqrt(a);

cout<<fixed<<setprecision(b)<<c;

return 0;
}

@sonu28sharma99 what is the problem that you are facing. Please send your code so that I can understand what is your problem

Please read it properly…then reply me …

@sonu28sharma99 I can see that you have implemented this correctly. There must be some other constraints or problem statement might be different. Can you send me the questions link

Take the following as input.

A number (N)
A number §
Write a function which returns the square root of N correct to precision P. Print the value returned

Input Format
Constraints
0 < N < 1000000000 0 < P < 5

Output Format
Sample Input
27
2
Sample Output
5.19
Explanation
Take care of java’s weird behaviour on doubles.

This is the question of Hackerblock.
Question name : square root to precision.

@sonu28sharma99 You must use binary search for solving this problem. Check upto which number you are getting a value less than n . If it passes then reduce r correspondingly.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.