Solution Review: Calculate (a + b)^3
This lesson gives a detailed solution review of the challenge in the previous lesson.
We'll cover the following...
Solution :
Press + to interact
fn test() {let a = 2;let b = 2;let c = i32::pow(a,3) + i32::pow(b, 3) + ( 3 * a * b * (a + b)) ;println!("{}",c);}
Explanation
- On line 2, a variable
a
with value2
is declared. - On line 3, a variable
b