comit
This commit is contained in:
commit
cc3c8c24cf
|
@ -0,0 +1 @@
|
|||
/target
|
|
@ -0,0 +1,7 @@
|
|||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "fizzbuzz"
|
||||
version = "0.1.0"
|
|
@ -0,0 +1,8 @@
|
|||
[package]
|
||||
name = "fizzbuzz"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
|
@ -0,0 +1,19 @@
|
|||
fn main() {
|
||||
let end: u32 = 100;
|
||||
let mut int: u32 = 1;
|
||||
|
||||
while (&end != &int) {
|
||||
int = int + 1;
|
||||
let mut output = String::new();
|
||||
if (&int % 3 == 0) {
|
||||
output = format!("fizz");
|
||||
}
|
||||
if (&int % 5 == 0) {
|
||||
output = format!("{}{}", output, "buzz");
|
||||
}
|
||||
if ((&int % 3 != 0) & (&int % 5 != 0)) {
|
||||
output = int.to_string();
|
||||
}
|
||||
println!("{output}");
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue