Important point:

  • Import math library and use built in square root function which is sqrt()

# Algorithm

  1. Create  variable num and root.
  2. Enter the number whose  root is to be calculated.
  3. Get the  root using function sqrt().
#include<iostream>
#include<math.h>
using namespace std;

int main(){
  float num;
  float root;
  cout << "Enter number to find square root: ";
  cin >> num;
  root = sqrt(num);
  cout << "Square root of" << number << " is " << root;
  return 0;
}