• Register
Welcome to Techno Smarter QA, Questions, Answers Community
Welcome to Techno Smarter Q&A, where you can ask questions and receive answers from other members of the community. Ask the tech & programming Question that you want. Guests Posting are allowed.
+2 votes
14 views

I want to use the (a2+b2) mathematical formula in PHP programming. Is it possible to convert the mathematics formula in the PHP language? This is the solution for the square of a plus square of b.

I am a beginner in PHP programming. I won't get the solution of (a2 +b2) in PHP language.

in PHP by (1.8k points) 1 5 26

1 Answer

0 votes

Yes, it is possible to find out the value in PHP language. You can use HTML language to display the exact format of a square + b square (a2+b2). In any programming language, you need to know about the variables. PHP variables help to save the data type’s values and you can use this variable in PHP operation. This is the mathematic formula (a2 +b2). First of all, think about the variables. There are two variables a and b in this mathematic formula (a2 +b2). In the PHP language, the variables are declared by the $ sign.

$a;

$b;

You can write the mathematic formula (a2 +b2) like this –

a*a+b*b

Use this method in PHP and get the result .

<?php

//change values according your need

$a=2;

$b=3;

$result=($a*$a+$b*$b);

echo "(a<sup>2</sup>+b<sup>2</sup>)=".$result;

?>

It produces the output –

(a2+b2)=13

In the PHP code above, you can change the values of the variables. You need to learn PHP data types to provide any values with variables.

by (7.1k points) 4 21 46
...