-3
\$\begingroup\$

You have 2 numbers, both stored separate as numeric data type.

First number is always 6 digits long.

Second number can vary between 1 and 4 digits. If it's less than 4 digits, it needs to be padded with numeric value 0.

End result always needs to be 10 digits number.

Order has to be respected. n1|n2

Example #1:

n1 = 111111
n2 = 2222
result = 1111112222

Example #2:

n1 = 333333
n2 = 44
result = 3333330044

The rule is that you can only use numeric data types (number, int, float, decimal) to get the desired result.

\$\endgroup\$

closed as off-topic by Luis Mendo, Jo King, Arnauld, manatwork, Renzeee Oct 2 '18 at 11:39

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions without an objective primary winning criterion are off-topic, as they make it impossible to indisputably decide which entry should win." – Jo King, Arnauld, manatwork
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    \$\begingroup\$ you can only use numeric data types That's close to being an unobservable requirement. What if a function I call uses strings internally? Also, this needs a winning criterion. Code golf? \$\endgroup\$ – Luis Mendo Oct 2 '18 at 9:34
  • \$\begingroup\$ I have a function that converts my number to a string to process it. Am I allowed to use it? \$\endgroup\$ – Jo King Oct 2 '18 at 11:10
  • 1
    \$\begingroup\$ This one seems really interesting. The only problem is that not every language can guarantee the type at every point of a variable's use. Need to maybe loosen that up a bit (or even restrict to languages that don't require any conversions, internally or otherwise). \$\endgroup\$ – ouflak Oct 5 '18 at 7:42
3
\$\begingroup\$

MathGolf, 3 bytes

♫*+

Try it online!

Explanation:

      Implicit input
 ♫*   Multiply first argument by 10000
   +  Add the two arguments
      Implicit output
\$\endgroup\$
  • 3
    \$\begingroup\$ Every time i think "This seems like a good challenge for MathGolf", I find you in the answers. Nice answer, goes really well with my idea of having lots of numerical constants to aid in golfing. \$\endgroup\$ – maxb Oct 2 '18 at 12:18
2
\$\begingroup\$

MATL, 5 bytes

1e4*+

Uses only addition and multiplication.

Try it online!

\$\endgroup\$
2
\$\begingroup\$

05AB1E, 4 bytes

4°*+

Try it online!

\$\endgroup\$
1
\$\begingroup\$

Ruby, 14 bytes

->a,b{a*1e4+b}
\$\endgroup\$
1
\$\begingroup\$

brainfuck, 45 bytes

,.,.,.,.,.,.,[-->+++>+++>+++<<<],[<,]>>>>[.<]

Try it online!

Assumes the inputted numbers are separated by a single space

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.