Skip to content

Commit

Permalink
first activity of session2
Browse files Browse the repository at this point in the history
  • Loading branch information
Cryptonean committed Sep 11, 2024
1 parent 53eb8c0 commit 2c96d66
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions validators/activity_1.ak
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// - Activity 001 - Create the substraction (-) function and test it

fn sub (x:Int , y:Int) -> Int{
x-y
}

test sub_test(){
sub(5,2) ==3
}

fn sum(x,y) -> Int {
x+y
}


//- Activity 002 - Create the multiplication (*) function and test it

fn mul(x:Int, y :Int) -> Int{
x*y
}

test mul_test(){
mul(5,2) == 10
}

// - Activity 003 - Create the division (/) function and test it


fn divd(x,y) {
x/y
}

test divd_test(){
divd(10,5) == 2
}

//- Activity 004 - Modify the main function that uses the sum function and the new functions created in the previous practices and test it

fn main() {
let result = sum (2,3)
let result = sub(result,1)
let result = mul(result,2)
let result = divd (result,2)
result
}

test main_test(){
main()==4
}

0 comments on commit 2c96d66

Please sign in to comment.