create file in a loop which writes numbers from 1 to 10 in every line in rust
main.rs
use std::fs::File;
use std::io::Write;
fnmain() {
for i in1..=10 {
letmut file = File::create(format!("output{}.txt", i)).expect("Unable to create file");
writeln!(file, "{}", i).expect("Unable to write to file");
}
}