Numeric machine

From Esolang
Jump to navigation Jump to search

Numeric machine is a program form designed by PSTF.

Overview

A numeric machine should do like this:

  1. Receive user input.
  2. If the user enters 0, output 0 infinitely.
  3. Otherwise, let the number entered by the user be n, and output this number n times.
  4. If the user enters a negative number, take its absolute value.
  5. If the user enters a decimal, truncate the decimal part, and then process it according to the rules for integers.

Challenge Area

Python

a = int(input())
if a == 0:
    while True:
        print(0)
else:
    a = abs(a) # The absolute value of a positive number is itself
    for i in range(a):
        print(a)

The Second Coming

open a = Int(input())
if a == 0:
    while True:
        print(0)
    endwhile
else:
    a = abs(a) # The absolute value of a positive number is itself
    for i in interval(a):
        print(a)
    endfor
endif

<><

Note: <>< don't have numeric input, so the program will input a character and output it x times where x is character code. 0 outputs NUL infinitely

i:&:?v>0o<
&;!?:<-1&o:

node.js

uses prompt for input

y=x=+prompt()
y=z=Math.abs(Math.trunc(x))
while(y--||!z)console.log(x)

Septem Lingua

let i <- float(stdin)
@import abs,floor from math
let j <- floor(abs(i))
if j==0 then
    while j==0 do
        print i
    end
else
    for i from 1 to j do
        print i
    end
end

See Also

Categories