26
\$\begingroup\$

As the majority of nations using the Euro have the , as the decimal separator, you must use it also.

The task is to output all the values of the Euro coins and notes in ascending order. You must also put the trailing ,00 on the integer values.

0,01 0,02 0,05 0,10 0,20 0,50 1,00 2,00 5,00 10,00 20,00 50,00 100,00 200,00 500,00

I accept both output to stdout or a function returning an array/list. If output is to stdout, the acceptable separators between values are: space, tab, or newline.

There will be no accepted answer, unless I see some one I find very creative.

, so I want to know shortest answer by language.

Update:

Leading 0 zeros are not acceptable. Sorry, I should make it clear before.

Update 2:

It is also acceptable a function returning a string.

\$\endgroup\$

34 Answers 34

1
2
0
\$\begingroup\$

VBA, 94 93 92 Bytes

Anonymous VBE immediate window function that takes no input and outputs the euro units to the VBE immediate window.

Restricted to 32-Bit VBA as exponentiation of the form a^b throws an error in 64-Bit VBA. To run in 64-Bit, change 10^j to 10 ^j.

For j=-2To 2:For Each i In Array(1,2,5):?Replace(Format(i*10^j,"0.00"),".",",")" ";:Next i,j

-1 Byte for replacing Next:Next with Next i,j

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Extra space in 10 ^j, isn't it? Can't run, keeps saying "Expected: expression". \$\endgroup\$ – LS_ᴅᴇᴠ Oct 24 '17 at 8:17
  • \$\begingroup\$ @LS_ᴅᴇᴠ - its actually a result of a slight difference in exponentiation between 64 bit and 32 Bit VBA - namely that a^b throws an error in 64-bit VBA and not 32-Bit; I Just double checked and this runs perfectly without error in the 64-Bit Version. That said, and assuming that this runs fine without the space in 32-Bit VBA, I'll restrict the source and remove the single byte \$\endgroup\$ – Taylor Scott Oct 24 '17 at 19:05
0
\$\begingroup\$

Kotlin, 100 99 bytes

Submission

fun g(){var i=1
while(i<1e5){listOf(1,2,5).map{print("%d,%02d ".format(i*it/100,i*it%100))}
i*=10}}

Runner

fun g(){var i=1
while(i<1e5){listOf(1,2,5).map{print("%d,%02d ".format(i*it/100,i*it%100))}
i*=10}}

fun main(vararg string: String) {
    g()
}

TryItOnline

Link

Edits

-1 | println -> print

| improve this answer | |
\$\endgroup\$
0
\$\begingroup\$

Perl 6, 50 45 bytes

{TR/./,/}o{((10 X**^5-2)X*1,2,5).fmt('%.2f')}

Try it online!

Function returning a string.

| improve this answer | |
\$\endgroup\$
0
\$\begingroup\$

MathGolf, 25 24 bytes

5125ß*m{ï3/ú*_♀/\♀%αû,0u

Try it online!

Explanation

5                          Push 5
 125ß                      Push [1,2,5]
     *                     Multiply
      m{                   Map each element to...
        ï                  Push map index
         3/                Divide by 3
           ú               Push 10**TOS
            *              Multiply           
             _             Duplicate element
              ♀/           Divide by 100
                \♀%        Swap top two elements and calculate TOS % 100
                   α       Wrap last two elements in array
                    û,0    Push ",0"
                       u   Join array with separator
| improve this answer | |
\$\endgroup\$
1
2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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