Skip to content

Commit c1e43d2

Browse files
committed
truncated_square_root.cpp: Solves issue matthewsamuel95#150
Added cpp file for calculating root using library functions sqrt and floor. Will solve issue matthewsamuel95#150.
1 parent 23db48c commit c1e43d2

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

Math/truncated_square_root/a.out

13 KB
Binary file not shown.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#include <iostream>
2+
#include <cstdio>
3+
#include <cstdlib>
4+
#include <cmath>
5+
6+
using namespace std;
7+
8+
int main() {
9+
double a = 0;
10+
cout<<"Enter an integer:"<<endl;
11+
cin>>a;
12+
if (a <= 0) return 0;
13+
printf("Square root of %lf is: %.0lf \n",a,floor(sqrt(a)));
14+
return 0;
15+
}

0 commit comments

Comments
 (0)