Compare commits
No commits in common. "bca900b6924417b9a8a72656df6003490e6453c7" and "852f5a9b76a1eb57da3b00c9454d1f42154a7ba9" have entirely different histories.
bca900b692
...
852f5a9b76
6 changed files with 0 additions and 73 deletions
7
fibonacci/Cargo.lock
generated
7
fibonacci/Cargo.lock
generated
|
@ -1,7 +0,0 @@
|
|||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "fibonacci"
|
||||
version = "0.1.0"
|
|
@ -1,6 +0,0 @@
|
|||
[package]
|
||||
name = "fibonacci"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
|
@ -1,17 +0,0 @@
|
|||
use std::io;
|
||||
|
||||
fn main() {
|
||||
let mut input = String::new();
|
||||
println!("Please enter the number to calculate the Fibonacci sequence for.");
|
||||
io::stdin().read_line(&mut input).expect("An error occurred!");
|
||||
let value: u32 = input.trim().parse().unwrap();
|
||||
println!("Result: {}", fibonacci(value));
|
||||
}
|
||||
|
||||
fn fibonacci(end: u32) -> u32 {
|
||||
if end <= 1 {
|
||||
1
|
||||
} else {
|
||||
fibonacci(end - 2) + fibonacci(end - 1)
|
||||
}
|
||||
}
|
7
hottie/Cargo.lock
generated
7
hottie/Cargo.lock
generated
|
@ -1,7 +0,0 @@
|
|||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "hottie"
|
||||
version = "0.1.0"
|
|
@ -1,6 +0,0 @@
|
|||
[package]
|
||||
name = "hottie"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
|
@ -1,30 +0,0 @@
|
|||
use std::io;
|
||||
|
||||
fn main() {
|
||||
let mut input = String::new();
|
||||
let celsius: bool = {
|
||||
loop {
|
||||
println!("Please enter the unit you wish to convert from:");
|
||||
println!("0: Celsius");
|
||||
println!("1: Fahrenheit");
|
||||
io::stdin().read_line(&mut input).expect("An error occurred!");
|
||||
|
||||
break match input.trim().parse::<i32>() {
|
||||
Err(_) => {
|
||||
println!("The specified input `{}` is invalid.", input.trim());
|
||||
continue;
|
||||
},
|
||||
Ok(value) => {
|
||||
value == 0
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
let mut input = String::new();
|
||||
println!("Please enter the value to convert:");
|
||||
io::stdin().read_line(&mut input).expect("An error occurred!");
|
||||
let value: f64 = input.trim().parse().unwrap();
|
||||
|
||||
println!("result: {}", if celsius { value * 9.0 / 5.0 + 32.0 } else { (value - 32.0) * 5.0 / 9.0 })
|
||||
}
|
Loading…
Reference in a new issue