Please give a code to find out the square root of a given number. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Please give a code to find out the square root of a given number.

24th Oct 2016, 5:37 PM
Tejas Sakhalkar
Tejas Sakhalkar - avatar
3 Answers
+ 1
#include <iostream> #include <cmath> using namespace std; int main() { int n; cin >> n; cout << sqrt(n) << endl; return 0; }
25th Oct 2016, 10:15 AM
Zen
Zen - avatar
0
#include <stdio.h> #include <math.h> int main() { double a; double b; printf("enter b"); scanf("%f",&b); a=sqrt(b); }
24th Oct 2016, 5:58 PM
Osvaldo López Ruiz
Osvaldo López Ruiz - avatar
0
sorry #include <stdio.h> #include <math.h> int main() { double a; double b; printf("enter b"); scanf("%f",&b); a=sqrt(b); return 0; }
24th Oct 2016, 6:01 PM
Osvaldo López Ruiz
Osvaldo López Ruiz - avatar