32, 33
This commit is contained in:
parent
853d0ced19
commit
5788b5df57
2 changed files with 26 additions and 2 deletions
|
@ -1 +1,7 @@
|
||||||
pub fn main() {}
|
pub fn main() {
|
||||||
|
for i in 1..5 {
|
||||||
|
for j in 0..10 {
|
||||||
|
println!("{i}{j}{i}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
20
src/u33.rs
20
src/u33.rs
|
@ -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")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue