Q:

C++ Program to find Square Root of a number using sqrt() function

belongs to collection: C++ Number Solved Programs

0

Write a C++ Program to find Square Root of a number using sqrt() function. Here’s simple program to find Root of a Number using sqrt() function in C++ Programming Language.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Square root in C++ can be calculated using sqrt() function defined in math.h header file. This function takes a number as an argument and returns the square root of that number.

 
 

Here is source code of the C++ Program to find SquareRoot of a number using sqrt() function. The C++ program is successfully compiled and run(on Codeblocks) on a Windows system. The program output is also shown in below.


SOURCE CODE : :

/*  C++ Program to find Square  Root of a number using sqrt() function */

#include<iostream>
#include<math.h>

using namespace std;

int main()
{
    float sq,n;

    cout<<"Enter any positive number :: ";
    cin>>n;

    sq=sqrt(n);

    cout<<"\nSquare  root of Entered Number [ "<<n<<" ] is :: "<<sq<<"\n";

    return 0;
}

Output : : 


/*  C++ Program to find SquareRoot of a number using sqrt() function */

Enter any positive number :: 10000

Square root of Entered Number [ 10000 ] is :: 100

Process returned 0

Above is the source code for C++ Program to find SquareRoot of a number using sqrt() function which is successfully compiled and run on Windows System.The Output of the program is shown above .

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C++ Number Solved Programs

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
C++ Program to Check whether given number is Even ... >>
<< Write a C++ Program to find Addition of Two Number...