We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9df8e00 commit 93d62f0Copy full SHA for 93d62f0
Rust/rustifinity/challenges/countdown.rs
@@ -0,0 +1,15 @@
1
+pub fn countdown(n: u32) -> Vec<u32> {
2
+ // TODO: Implement the countdown using a while loop
3
+if n == 0 {
4
+ vec![0]
5
+ } else {
6
+ let mut vect : Vec<u32> = Vec::new();
7
+ let mut m = n;
8
+ while m > 0 {
9
+ vect.push(m);
10
+ m -= 1;
11
+ }
12
+ vect.push(0);
13
+ vect
14
15
+}
Rust/rustifinity/challenges/if-else.rs
@@ -0,0 +1,8 @@
+pub fn is_even(n: i32) -> bool {
+ // Your code here...
+ if n % 2 == 0 {
+ true
+ false
Rust/rustifinity/challenges/sum-of-even-numbers.rs
@@ -0,0 +1,9 @@
+pub fn sum_of_evens(start: i32, end: i32) -> i32 {
+ let mut sum = 0;
+ for num in start..=end + 1 {
+ if num % 2 == 0 {
+ sum += num;
+ sum
0 commit comments