Browse Source

Update README.md

1274-oddlength
Hamza elkhatri 2 years ago committed by David Mata
parent
commit
6f590b8f6e
  1. 7
      subjects/binaryaddition/README.md

7
subjects/binaryaddition/README.md

@ -3,8 +3,8 @@
### Instructions ### Instructions
Write a function named `BinaryAddition(int,int)` that takes two integers and returns the sum of the two in binary in an array of `int`. Write a function named `BinaryAddition(int,int)` that takes two integers and returns the sum of the two in binary in an array of `int`.
- If the sum is negative return `nil` value. - If one of the integers is negative return `nil`
- convert the argument to binary then add the two binary numbers together - Convert the argument to binary then add the two binary numbers together
### Expected function ### Expected function
```go ```go
@ -29,7 +29,7 @@ func main(){
fmt.Println(BinaryAddition(1, 3)) fmt.Println(BinaryAddition(1, 3))
fmt.Println(BinaryAddition(2, 1)) fmt.Println(BinaryAddition(2, 1))
fmt.Println(BinaryAddition(2, 2)) fmt.Println(BinaryAddition(2, 2))
fmt.Println(BinaryAddition(2, 3)) fmt.Println(BinaryAddition(1, 16))
} }
``` ```
@ -43,4 +43,5 @@ $ go run .
[0 1 1] [0 1 1]
[1 0 0] [1 0 0]
[1 0 1] [1 0 1]
[1 0 0 0 0]
``` ```

Loading…
Cancel
Save