7 kyu

Binary Calculator

871 of 2,875lkspencer

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 Trained6892
Total Skips857
Total Code Submissions14106
Total Times Completed2875
JavaScript Completions871
Python Completions800
Ruby Completions245
Java Completions854
Swift Completions207
Total Stars93
% of votes with a positive feedback rating91% of 380
Total "Very Satisfied" Votes318
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