Generation

generate functionThu, 26 Jan 2023

write a function which return word fun if argument is from 1 to 10, word novice if argument is from 11 to 20, in other cases word must be buff

use std::io; fn main() { let mut input = String::new(); io::stdin().read_line(&mut input).expect("Error read line"); let number = input.trim().parse::<i32>().expect("Error parse"); if number >= 1 && number <= 10 { println!("fun"); } else if number >= 11 && number <= 20 { println!("novice"); } else { println!("buff"); } }

Questions about programming?Chat with your personal AI assistant