Dateien nach „/“ hochladen
This commit is contained in:
parent
e764095ec1
commit
856de9da2a
7
Cargo.lock
generated
Normal file
7
Cargo.lock
generated
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 3
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "Squares"
|
||||||
|
version = "0.1.0"
|
6
Cargo.toml
Normal file
6
Cargo.toml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
[package]
|
||||||
|
name = "Squares"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
[dependencies]
|
15
main.rs
Normal file
15
main.rs
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
use std::{i128, io};
|
||||||
|
fn main() {
|
||||||
|
println!("To which number do you want the squares");
|
||||||
|
let mut p = 0;
|
||||||
|
let mut x = 0;
|
||||||
|
let mut limit = String::new();
|
||||||
|
io::stdin().read_line(&mut limit).expect("error");
|
||||||
|
let mut limit = limit.trim().parse().expect("Type a number");
|
||||||
|
limit = limit + 1;
|
||||||
|
while x < limit {
|
||||||
|
p = i128::pow(x, 2);
|
||||||
|
println!("{}", p);
|
||||||
|
x = x + 1;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue