This commit is contained in:
DavidOnTop 2025-03-27 13:26:58 +01:00
parent 853d0ced19
commit 5788b5df57
Signed by: DavidOnTop
GPG key ID: 8D3E9A75E3E13D89
2 changed files with 26 additions and 2 deletions

View file

@ -1 +1,7 @@
pub fn main() {}
pub fn main() {
for i in 1..5 {
for j in 0..10 {
println!("{i}{j}{i}")
}
}
}

View file

@ -1 +1,19 @@
pub fn main() {}
pub fn main() {
println!("Zadaj cislo a znacku (F/C)");
let mut input = String::new();
std::io::stdin().read_line(&mut input).unwrap();
let mut input = input.trim().to_string();
let unit = input.remove(input.len() - 1);
let num: f64 = input.parse().expect("Neda sa retazec premenit na cislo");
match unit {
'C' | 'c' => {
println!("{}F", num * 1.8 + 32.0)
}
'F' | 'f' => {
println!("{}C", (num - 32.0)/1.8)
}
_ => {
println!("nepodporovana znacka")
}
}
}