+ 3

# How to write (a + b)² in code

10 Réponses

+ 12

Khushi Kashyap if you are talking about in html then we can write in 2 ways:-
<p>(a+b)<sup>2</sup></p>
<p>(a + b)<sup>2</sup></p>

+ 10

((a*a) + (b*b) + (2*a*b)) beginner friendly😎

+ 7

in JS
let a = 2
let b = 3
let c = Math.pow(a+b, 2);
console.log( c )

+ 6

Specify your programming language

+ 4

Which code specifically like which language

+ 3

this can apply to several languages including python
a=2
b=4
(a+b)**2

+ 3

let r = 9
let t = 4
let s = Math. pow(r+t
, 9);
Console.log(s)

+ 3

In java you can write as math.pow(a+b, 2)

+ 2

use unicode character for ² which is \u00b2

0

Most of you are not into python here