Link Search Menu Expand Document

Challenge 2: Count Iterations of a Loop Until a Condition

  • Problem Statement

    • A variable x is provided to you.
    • Repeatedly decrease the value of the variable x by 3 each time, as long as x is greater than or equal to 0.
    • Print the number of times the iteration runs.

Input

integer

Output

iteration count

Sample Input

21

Sample Ouput

   8

Coding Exercise

fn test(mut x:i32) {
    // Write code here!
}

Good luck! 🤞