Rust Program to Add two Numbers
Program
fn main()
{
let a = 10;
let b = 20;
let c = a + b;
println!("Sum of {0} and {1} is {2}", a, b, c);
}
Output
$ rustc AddTwoNumbers.rs
$ ./AddTwoNumbers
Sum of 10 and 20 is 30
Program
fn main()
{
let a = 10;
let b = 20;
let c = a + b;
println!("Sum of {0} and {1} is {2}", a, b, c);
}
Output
$ rustc AddTwoNumbers.rs
$ ./AddTwoNumbers
Sum of 10 and 20 is 30