summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ex2/Cargo.lock7
-rw-r--r--ex2/Cargo.toml6
-rw-r--r--ex2/src/main.rs10
3 files changed, 23 insertions, 0 deletions
diff --git a/ex2/Cargo.lock b/ex2/Cargo.lock
new file mode 100644
index 0000000..900fa72
--- /dev/null
+++ b/ex2/Cargo.lock
@@ -0,0 +1,7 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 4
+
+[[package]]
+name = "ex2"
+version = "0.1.0"
diff --git a/ex2/Cargo.toml b/ex2/Cargo.toml
new file mode 100644
index 0000000..c6a7358
--- /dev/null
+++ b/ex2/Cargo.toml
@@ -0,0 +1,6 @@
+[package]
+name = "ex2"
+version = "0.1.0"
+edition = "2024"
+
+[dependencies]
diff --git a/ex2/src/main.rs b/ex2/src/main.rs
new file mode 100644
index 0000000..6341539
--- /dev/null
+++ b/ex2/src/main.rs
@@ -0,0 +1,10 @@
+fn velocity(start: u32, end: u32, time: u32) -> u32 {
+ if end < start {
+ panic!("end < start");
+ }
+ end - start / time
+}
+
+fn main() {
+ println!("{}", velocity(5,15,4));
+}