Exerpad
🔥0
0 XP
Lv.1 Beginner
Log In

Fix the Conversion

The code below is supposed to read a number, double it, and print the result. But it has bugs! Can you fix them?

Hints:

  • Remember to trim the input before parsing.
  • Make sure the variable is mutable.
  • Check that you're parsing to the right type.
rust
use std::io;

fn main() {
let input = String::new();
io::stdin().read_line(&input).unwrap();
let number: i32 = input.parse().unwrap();
println!("{}", number * 2);
}