Last active
January 17, 2023 20:41
-
-
Save fermartz/b382d6cb34f0c4c67697dd553291f362 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Bool "mo:base/Bool"; | |
import Int "mo:base/Int"; | |
import Nat "mo:base/Nat"; | |
actor { | |
// ************************* | |
// *** CODING CHALLENGES *** | |
// ******* DAY ONE ********* | |
public func multiply(m : Nat, n : Nat) : async Nat { | |
m * n; | |
}; | |
public func volume(x : Nat) : async Nat { | |
Nat.pow(x,3); | |
}; | |
public func hours_to_minutes(n : Nat) : async Nat { | |
Nat.mul(n,60); | |
}; | |
stable var myCounter : Nat = 0; | |
public func set_counter(n : Nat) : async Nat { | |
myCounter := n; | |
myCounter; | |
}; | |
public query func get_counter() : async Nat { | |
myCounter; | |
}; | |
public func test_divide(n : Nat, m: Nat) : async Bool { | |
if(n > m or n== m and m != 0){ | |
true; | |
} else { | |
false; | |
}; | |
}; | |
public func is_even(n : Nat) : async Bool { | |
let res = Nat.rem(n,2); | |
if(res == 0){ | |
true; | |
} else { | |
false; | |
}; | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment