This commit is contained in:
Gnawmon 2024-02-04 13:02:35 +03:00
commit cc3c8c24cf
5 changed files with 38 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/target

7
Cargo.lock generated Normal file
View File

@ -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"

8
Cargo.toml Normal file
View File

@ -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]

3
README Normal file
View File

@ -0,0 +1,3 @@
fizz buzz program i've made to learn rust
yeh

19
src/main.rs Normal file
View File

@ -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}");
}
}