Exerpad
🔥0
0 XP
Lv.1 Beginner
Log In

Add Numbers

Create a function called add that takes two i32 parameters and returns their sum. Then call it from main and print the result.

Expected output:

text
3 + 5 = 8

Hints:

  • Define with fn add(a: i32, b: i32) -> i32
  • The last expression without a semicolon is the return value: a + b
  • In main, use println!("3 + 5 = {}", add(3, 5));
rust
fn main() {
}