How to add two numbers using function in Rust

1 Answer

0 votes
fn main() {
    let a: i32 = 34;
    let b: i32 = 79;
 
    let sum = get_sum(a,  b);
    
    println!("{}", sum);
}
 
fn get_sum(a: i32, b: i32) -> i32 {
    a + b
}



/*
run:
   
113
   
*/

 



answered Sep 29, 2022 by avibootz

Related questions

...