We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ca11cd7 commit 4d6e97bCopy full SHA for 4d6e97b
Math/squareroot
Math/squareroot/square_root.cpp
@@ -0,0 +1,23 @@
1
+#include<iostream>
2
+#include<math.h>
3
+using namespace std;
4
+
5
+int sqrt(int x)
6
+{
7
+ if(x==0) return 0;
8
9
+ int counter=1;
10
+ while(pow(counter,2)<=x){
11
+ counter++;
12
+ }
13
+ counter--;
14
+ return counter;
15
+}
16
+int main()
17
18
+ int n;
19
+ cout<<"Enter Number\n";
20
+ cin>>n;
21
+ cout<<"The square root of the number is: "<<sqrt(n)<<endl;
22
+ return 0;
23
0 commit comments