Complete these tasks to reinforce what you learned in this module.
Use an if/else expression to set a variable parity to "even" when n is even and "odd" when odd, then print it. Use n = 4.
if in Rust is an expression; both branches must produce the same type. Use the remainder operator to detect even/odd.// Task 1: if expression for parity. See tasks/TASKS.md.
fn main() {
let n = 4;
// YOUR CODE HERE: let parity = if n % 2 == 0 { "even" } else { "odd" }; then print
todo!("Implement parity with if expression");
}
Use a for loop over 1..=5 to compute the sum of 1 through 5 and print it.
for loop over an inclusive range.// Task 2: for loop sum. See tasks/TASKS.md.
fn main() {
// YOUR CODE HERE: sum 1..=5, print "sum = 15"
todo!("Implement for loop sum");
}