Link Search Menu Expand Document

Challenge 1: Check Divisibility by 3 and 4

  • Problem Statement

Write a function test_divisibility_by_3_4 which will check whether a given integer number is divisible by 3 or 4.

  • If the number is divisible by both return 0
  • If the number is divisible by 3 only return 1
  • If the number is divisible by 4 only return 2
  • If the number is not divisible by both, return -1

  • Input ``` integer
Output 

The output can be any of the following:
0 , 1 , 2 ,-1 ``` Sample Input  ```
12 , 9 , 16 , 19 ``` Sample Output  ```
0 , 1 , 2 , -1 ```

Coding Exercise

fn test_divisibility_by_3_4(a:i32) -> i32{
    // Write code here
    -10
}

Good luck!🤞