Q:
PHP find output programs (Math Functions) | set 1
belongs to collection: PHP Find Output Programs
PHP Find Output Programs
- PHP find output programs (basics) | set 1
- PHP find output programs (basics) | set 2
- PHP find output programs (basics) | set 3
- PHP find output programs (Superglobals) | set 1
- PHP find output programs (conditional statements) | set 1
- PHP find output programs (conditional statements) | set 2
- PHP find output programs (conditional statements) | set 3
- PHP find output programs (switch Statement) | set 1
- PHP find output programs (switch Statement) | set 2
- PHP find output programs (switch Statement) | set 3
- PHP find output programs (Operators) | set 1
- PHP find output programs (Operators) | set 2
- PHP find output programs (Operators) | set 3
- PHP find output programs (Loops) | set 1
- PHP find output programs (Loops) | set 2
- PHP find output programs (Loops) | set 3
- PHP find output programs (Loops) | set 4
- PHP find output programs (Arrays) | set 1
- PHP find output programs (Arrays) | set 2
- PHP find output programs (Arrays) | set 3
- PHP find output programs (User-defined functions) | set 1
- PHP find output programs (User-defined functions) | set 2
- PHP find output programs (User-defined functions) | set 3
- PHP find output programs (String Functions) | set 1
- PHP find output programs (String Functions) | set 2
- PHP find output programs (Number Functions) | set 1
- PHP find output programs (Math Functions) | set 1
- PHP find output programs (Math Functions) | set 2
- PHP find output programs (Date and Time) | set 1
- PHP find output programs (define Constant) | set 1
- PHP find output programs (static variables, classes, methods) | set 1
- PHP find output programs (static variables, classes, methods) | set 2
- PHP find output programs (Regular Expressions) | set 1
- PHP find output programs (Exceptions) | set 1
- PHP find output programs (Exceptions) | set 2
- PHP find output programs (Filters) | set 1
- PHP find output programs (Filters) | set 2
- PHP find output programs (JSON) | set 1
- PHP find output programs (const Keyword) | set 1
- PHP find output programs (Class & Objects) | set 1
- PHP find output programs (Class & Objects) | set 2
- PHP find output programs (Class & Objects) | set 3
- PHP find output programs (Constructors and Destructors) | set 1
- PHP find output programs (Constructors and Destructors) | set 2
- PHP find output programs (Constructors and Destructors) | set 3
- PHP find output programs (Inheritance) | set 1
- PHP find output programs (Inheritance) | set 2
- PHP find output programs (Inheritance) | set 3
Answer 1:
Output:
Explanation:
In the above program, we created a variable $radius which is initialized with 5. Here, we used PI() function that returns 3.1415926535898.
Here, we calculated the area of circle and circumference of the circle. And now evaluate the expression.
$area = PI() * $radius * $radius; $area = 3.1415926535898 * 5 * 5; $area = 78.539816339745;
And,
$cir = 2 * pi() * $radius; $cir = 2 * 3.1415926535898 * 5; $cir = 31.415926535898;
After calculating the area and circumference of the circle, we print values of $area, $cir on the webpage.
Answer 2:
Output:
Explanation:
The above program will generate the compile-time error because we declared a variable $list and tried to assign a list of values to it, it is not the correct way. To assign a list of values to a single variable, we need to create an array. The proper way is given below:
$list = array(1,2,3,4,5);
Answer 3:
Output:
Explanation:
In the above program, we created an array of integer values, that contains the value (1,2,3,4,5). After that we used two built-in PHP function min() and max().
The max() function is used to get the highest value from the array that is 5, and min() function is used to get the lowest value from array that is 1.
$mid = (5+1)/2; $mid = 3;
Then the final value of $mid that is 3, will be printed on the webpage.
Answer 4:
Output:
Explanation:
In the above program, we used two built-in PHP function min() and max().
The max() function is used to get the highest value from the specified list that is 5, and min() function is used to get the lowest value from the specified list that is 1.
$mid = (5+1)/2; $mid = 3;
Then the final value of $mid which is 3, will be printed on the webpage.
Answer 5:
Output:
Explanation:
In the above program, we created two variables $A, $B, and $C initialized with 3, -5, and 1 respectively. Here, we used two built-in function abs() and sqrt().
The abs() function always returns the positive or absolute value, and sqrt() is used to calculate the square root of a specified number.
Now evaluate the expression:
$D = (abs($B) + sqrt($B*$B-3*$A*$C)) / (2 *$A); $D = (5 +sqrt(-5*-5-3*3*1))/6; $D = (5 +sqrt(25-9))/6; $D = (5 +4)/6; $D = 9/6; $D = 1.5;
Then the final value of $D will be printed on the webpage.
need an explanation for this answer? contact us directly to get an explanation for this answer