7 kyu

Binary Calculator

797 of 2,868lkspencer

Description:

In this kata you need to write a function that will receive two strings (n1 and n2), each representing an integer as a binary number. A third parameter will be provided (o) as a string representing one of the following operators: add, subtract, multiply.

Your task is to write the calculate function so that it will perform the arithmetic and the result returned should be a string representing the binary result.

Examples:

1 + 1 === 10
10 + 10 === 100

Negative binary numbers are usually preceded by several 1's. For this kata, negative numbers can be represented with the negative symbol at the beginning of the string.

Examples of negatives:

1 - 10 === -1
10 - 100 === -10
Binary
Algorithms

More By Author:

Check out these other kata created by lkspencer

Stats:

CreatedNov 18, 2014
PublishedNov 18, 2014
Warriors Trained6882
Total Skips857
Total Code Submissions14081
Total Times Completed2868
JavaScript Completions869
Python Completions797
Ruby Completions245
Java Completions853
Swift Completions206
Total Stars93
% of votes with a positive feedback rating91% of 379
Total "Very Satisfied" Votes317
Total "Somewhat Satisfied" Votes53
Total "Not Satisfied" Votes9
Ad
Contributors
  • lkspencer Avatar
  • jhoffner Avatar
  • GiacomoSorbi Avatar
  • SithFire Avatar
  • JDeBolt Avatar
  • mauro-1 Avatar
  • Just4FunCoder Avatar
Ad