![]() |
Given a Number, the task is to find the Square Root of Number in PHP. Examples: Input: 15 There are three methods to find the square root of the given number, these are:
Table of Content Using sqrt() FunctionThe sqrt() function is used to calculate the square root of a number. Syntax: float sqrt( $value )
Example: PHP
Output
Square Root: 6 Using pow() FunctionThe pow() function is used to calculate the power of a number. Here, we calculate the power 1/2 or 0.5 of given number. Syntax: pow($number, 0.5); Example: PHP
Output
Square Root: 5.4772255750517 Using Exponentiation Operator (**)The exponential operator (**) is used to calculate the exponent power of number. Here, we use exponent power to 0.5. Syntax: $number ** 0.5; Example: PHP
Output
Square Root: 6 |
Reffered: https://www.geeksforgeeks.org
Geeks Premier League |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 14 |