1#include <math.h>
2
3//get square root of a number "b"
4int main(){
5 int a = 2; //declare number you want to take square root of
6 int sqrtNum = sqrt (a); //assign the sqrt value to a variable
7 cout << sqrtNum << endl;
8 return 0;
9}
1#include <stdlib.h>
2#include <stdio.h>
3#include <math.h>
4
5/*
6square root of a number
7*/
8
9int main(){
10float num, raiz;
11printf("enter a number: \t");
12scanf("%f",&num);
13raiz = sqrt(num);
14printf("The square root of %f is: %f.\n", num, raiz);
15system("pause");
16return 0;
17}
1#include <iostream>
2#include <cmath>
3using namespace std;
4
5int main()
6{
7 int x = 625;
8 int result = sqrt(x);
9 cout << "Square root of " << x << " is " << result << endl;
10 return 0;
11}