Sha256: fca1fb99dd014bc1cbf14b39bcb7ab16dc3e3a869ff4ba2c225cdc7fd92f1b23
Contents?: true
Size: 629 Bytes
Versions: 23
Compression:
Stored size: 629 Bytes
Contents
;redcode ;name Celsius ;strategy cels = (fahr - 32) * 5 / 9 fahr DAT #80 ; input temperature cels DAT #0 ; store result here ftmp DAT #0 ; save fahr-32 here start MOV fahr, ftmp ; (1) subtract 32 SUB #32, ftmp mult ADD ftmp, acc ; (2) multiply by 5 SUB #1, count JMN mult, count div SUB #9, acc ; (3) divide by 9 SLT #0, acc DAT #0 ; stop here when division done ADD #1, cels JMP div acc DAT #0 ; accumulator count DAT #5 ; counter end start
Version data entries
23 entries across 23 versions & 1 rubygems