TI-BASIC (TI-84 + / SE), 36 바이트
startTmr→rand:1/(1<randInt(1,6:"I survived!
시도에서 지정한대로 입력이 없습니다. 성공하면
출력이고 그렇지 않으면 오류입니다.I survived!DIVIDE BY 0
DIVIDE BY 0다음과 같은 오류 화면 외모 :
ERR:DIVIDE BY 0
1:Quit
2:Goto
프로그램 호출 후 옵션 중 하나를 선택하면 ( 2선택된 경우 홈 화면으로 돌아 가기 ) 표시 Error됩니다.
예 :
prgmCDGFE
Error
prgmCDGFE
I survived!
prgmCDGFE
I survived!
prgmCDGFE
Error
설명:
startTmr→rand:1/(1<randInt(1,6:"I survived! ;full program
startTmr→rand ;store the current time into "rand"
; this is necessary because "rand" is 0 after
; factory reset, the default state for TI-BASIC
; submissions
randInt(1,6 ;get a random integer in [1,6]
1< ;is greater than 1? 1 if true, 0 if false
1/( ;divide 1 by the result
; throws "DIVIDE BY 0" error if result was
; false
"I survived! ;leave this string in "Ans"
;implicitly print "Ans"
노트:
randrange(5)구현 될 수 있습니다randrange(MAX_INT)%6.