From 856de9da2a0c43cd5ae5b8576c3241062464b150 Mon Sep 17 00:00:00 2001 From: robin Date: Sun, 22 Sep 2024 11:32:02 +0200 Subject: [PATCH] =?UTF-8?q?Dateien=20nach=20=E2=80=9E/=E2=80=9C=20hochlade?= =?UTF-8?q?n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.lock | 7 +++++++ Cargo.toml | 6 ++++++ main.rs | 15 +++++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 Cargo.lock create mode 100644 Cargo.toml create mode 100644 main.rs diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..c6456e4 --- /dev/null +++ b/Cargo.lock @@ -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" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..b057e5c --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "Squares" +version = "0.1.0" +edition = "2021" + +[dependencies] diff --git a/main.rs b/main.rs new file mode 100644 index 0000000..3f3bd0a --- /dev/null +++ b/main.rs @@ -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; + } +} \ No newline at end of file