organizado en carpetas
This commit is contained in:
8
curso_tinchicusls/condicion/Cargo.toml
Normal file
8
curso_tinchicusls/condicion/Cargo.toml
Normal file
@@ -0,0 +1,8 @@
|
||||
[package]
|
||||
name = "condicion"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
19
curso_tinchicusls/condicion/src/main.rs
Normal file
19
curso_tinchicusls/condicion/src/main.rs
Normal file
@@ -0,0 +1,19 @@
|
||||
use std::io;
|
||||
|
||||
fn main() {
|
||||
let mut entrada: String = String::new();
|
||||
|
||||
for _ in 0..3 {
|
||||
io::stdin().read_line(&mut entrada).unwrap();
|
||||
let n: i32 = entrada.trim().parse().unwrap();
|
||||
|
||||
if n < 0 {
|
||||
println!("{} es negativo", n);
|
||||
} else if n > 0 {
|
||||
println!("{} es positivo", n);
|
||||
} else {
|
||||
println!("Es cero");
|
||||
}
|
||||
entrada.clear();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user