Let's start Thursday off with a tricky problem. Your goal is to great a function that takes in 2 integers and returns the sum of them. The trick is that your program can not use the '+' operator.
Good luck!
Let's start Thursday off with a tricky problem. Your goal is to great a function that takes in 2 integers and returns the sum of them. The trick is that your program can not use the '+' operator.
Good luck!
Permalink: http://problemotd.com/problem/no-plus/
Content curated by @MaxBurstein
Comments:
Mark - 10 years, 1 month ago
private int Sum(int a, int b) { var array = new int[] { a, b };
}
reply permalink
Jordi - 10 years, 1 month ago
==>
CONCAT
12+89=101
reply permalink
dpim - 10 years, 1 month ago
reply permalink
Anon - 10 years, 1 month ago
reply permalink
Anonymous - 10 years, 1 month ago
Add a negative instead.
reply permalink
Anonymous - 10 years, 1 month ago
*Subtract a negative, I mean
reply permalink
Anonymous - 10 years, 1 month ago
reply permalink
David - 10 years, 1 month ago
Wow. I really don't even need to take any real effort to circumvent "typical" languages to do this with out explicitly using the build in addition functionality of a given language...
I will none the less do this in verilog. Because I haven't used it in about a year and a half.
Not having a compiler handy on this computer, I really hope my syntax is correct... o.oThe output wasn't working conveniently with he online compiler and I lost interest in this specifically. I'm sure there's a bug in here somewhere. And the comment box is complaining at me for posting the full thing in one box -_-
Here is a code generator in Python:
reply permalink