Functions are a fundamental building block in Rust, as in any programming language. They allow you to encapsulate logic and reuse code, making your programs more modular and easier to understand. In this challenge, you will define and implement a series of simple functions that perform basic operations.
Your task is to define three functions:
add(a: i32, b: i32) -> i32
- This function should return the sum of a
and b
.subtract(a: i32, b: i32) -> i32
- This function should return the difference between a
and b
.multiply(a: i32, b: i32) -> i32
- This function should return the product of a
and b
.You need to complete these functions so that they correctly perform the specified operations.
fn
keyword followed by the function name, parameters in parentheses, and the return type.return
keyword or just the last expression in the function body to return a value.pub
keyword to make your functions public so they can be accessed from other modules.kuttakke
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a + b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32 { a - b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32{ a * b}
terminox
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a + b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32 { a - b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 { a * b}
qiyuan711
pub fn add(a: i32, b: i32) -> i32 { a + b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32 { a - b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 { a * b}
apst
pub fn add(a: i32, b: i32) -> i32 { a + b}pub fn subtract(a: i32, b: i32) -> i32 { a - b}pub fn multiply(a: i32, b: i32) -> i32 { a * b}
jw
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a + b}pub fn subtract(a: i32, b: i32) -> i32 { a - b}pub fn multiply(a: i32, b: i32) -> i32 { a * b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.
nickythorne
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a + b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32 { a - b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 { a * b}
ryzen-xp
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition let sum = a + b ; sum }pub fn subtract( a: i32 , b : i32) -> i32 { a-b } pub fn multiply(a : i32 , b : i32)-> i32 { a*b }// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.
Derteq
pub fn add(a: i32, b: i32) -> i32 { a + b}pub fn subtract(a : i32, b : i32) -> i32{ a - b}pub fn multiply(a : i32, b : i32) -> i32{ a * b}
chuyuanlinzi
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a + b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32{ a - b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32{ a * b}
DV-13
pub fn add(a: i32, b: i32) -> i32 { a + b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32 { a - b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 { a * b}
tinthid
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a + b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32 { // Step 1: implement addition a - b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 { // Step 1: implement addition a * b}
yoakemae
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition return a + b;}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32 { return a - b;}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 { return a * b;}
martin-unit
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a+b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32 { // Step 1: implement addition a-b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 { // Step 1: implement addition a*b}
Neil-Rayu
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition return a+b;}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32 { return a-b;}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 { return a*b;}
RonaldoArayadev
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a+b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32 { a-b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 { a*b}
3ok
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition return a + b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32 { return a - b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 { return a * b}
leenalmajz
pub fn add(a: i32, b: i32) -> i32 { return a + b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract (a: i32, b: i32) -> i32 { return a - b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 { return a * b}
Thymelizabeth
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a + b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32 { a - b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 { a * b}
dalprahcd
pub fn add(a: i32, b: i32) -> i32 { a + b}pub fn subtract(a: i32, b: i32) -> i32 { a - b}pub fn multiply(a: i32, b: i32) -> i32 { a * b}
devarajang
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a + b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32 { a - b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 { a * b}
jeypiti
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a+b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b:i32) -> i32 { a -b }// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 { a*b}
konishu
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition return a + b;}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32 { return a - b;}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 { return a * b;}
nichideropa
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a + b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32 { a - b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 { a * b}
Cameo007
pub fn add(a: i32, b: i32) -> i32 { a + b}pub fn subtract(a: i32, b: i32) -> i32 { a - b} pub fn multiply(a: i32, b: i32) -> i32 { a * b}
aleksey-vareto
pub fn add(a: i32, b: i32) -> i32 { a + b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32 { a - b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 { a * b}
akshayabhattarai
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a+b}pub fn subtract(a: i32, b: i32) -> i32 { a-b}pub fn multiply(a: i32, b: i32) -> i32 { a*b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.
madeinheaven91
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a + b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32{ a - b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32{ a * b}
oDqnger
pub fn add(a: i32, b: i32) -> i32 { a + b}pub fn subtract(a: i32, b: i32) -> i32 { a - b}pub fn multiply(a: i32, b: i32) -> i32 { a * b}
matsuyama-k1
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition return a + b;}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a:i32, b:i32) -> i32 { return a - b;}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a:i32, b:i32) -> i32 { return a*b;}
otakumesi
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a + b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32 { a - b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 { a * b}
matsuby
pub fn add(a: i32, b: i32) -> i32 { return a + b;}pub fn subtract(a: i32, b: i32) -> i32 { return a - b;}pub fn multiply(a: i32, b: i32) -> i32 { return a * b;}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.
sy34
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition return a + b;}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32 { return a - b;}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 { return a * b;}
ankeetparikh
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a + b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32 { a - b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 { a * b}
0xsmarter
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition return a + b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32 , b : i32) -> i32 { return a - b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32 , b : i32) -> i32 { return a * b}
0xsmarter
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition return a + b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32 , b : i32) -> i32 { return a - b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32 , b : i32) -> i32 { return a * b}
aidan1magee
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a + b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32 { a-b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 { a*b}
maxvi
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a+b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32 { a-b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 { a*b}
P0TER19
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition let sum: i32 = a + b; return sum;}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32 { let sub: i32 = a - b; return sub;}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 { let mul: i32 = a * b; return mul;}
ugochukwudev
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a+b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a:i32,b:i32)->i32{a-b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a:i32,b:i32)->i32{a*b}
rafaellucasprogm
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a + b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b:i32) -> i32 { a - b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a:i32, b:i32) -> i32 { a * b}
WalquerX
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a + b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32 { a - b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 { a * b}
koslowskio
pub fn add(a: i32, b: i32) -> i32 { return a+b}pub fn subtract(a: i32, b: i32) -> i32 { return a-b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 { return a*b}
cloki0610
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a + b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32{ a - b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 { a * b}
Brack0
pub fn add(a: i32, b: i32) -> i32 { a + b}pub fn subtract(a: i32, b: i32) -> i32 { a - b}pub fn multiply(a: i32, b: i32) -> i32 { a * b}
shinuza
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a + b}pub fn subtract(a: i32, b: i32) -> i32 { a - b}pub fn multiply(a: i32, b: i32) -> i32 { a * b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.
tsucchinoko
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a + b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32 { a - b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 { a * b}
whitwulf
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a + b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32 { a - b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 { a * b}
risemacro
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a + b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b: i32) -> i32 { a - b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 { a * b}
Kobeieii
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a+b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a: i32, b:i32) -> i32 { a-b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a: i32, b: i32) -> i32 { a*b}
2k0ri
pub fn add(a: i32, b: i32) -> i32 { // Step 1: implement addition a+b}// Step 2:// Define a public function named `subtract`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn subtract(a:i32, b:i32) -> i32 { a-b}// Step 3:// Define a public function named `multiply`// that accepts two arguments of type `i32`// and returns an `i32`.// make sure you make the function public by using the `pub` keyword.pub fn multiply(a:i32, b:i32) -> i32 { a*b}