In Rust, you can use the *
operator to multiply two numbers. For example:
main.rs124 chars7 lines
In this example, we define two variables num1
and num2
with values 5 and 10 respectively. We then multiply these two numbers using the *
operator, and store the result in a third variable called result
. Finally, we print the value of result
to the console.
The output of this program would be:
main.rs18 chars2 lines
gistlibby LogSnag