5
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

IchigoJamAdvent Calendar 2017

Day 5

IchigoJamで素数ゲーム

Posted at

心を落ち着かせるときに使うゲームです。

ルール:入力した素数より大きな数値を入れていく

■概要
自分より小さな数で1つずつ増やして地道に割っていき、%であまりが無いかをチェク。あまりがゼロになったら素数ではないと判定

■プログラム
10 CLS:CLV:D=2
20 INPUT P
25 IF P>=32767 OR P<=1 THEN ?"OUT OF RANGE":END
30 IF X>=P THEN ?"SMALL OR SAME":END
40 IF D=P THEN GOTO 100
50 IF P%D=0 THEN ?"NOT SOSU":?"SCORE:";X:END
60 D=D+1
70 GOTO 40
100 X=P:D=2:GOTO 20

■オンラインサンプル実行(Chrome・FireFox・Edgeがサポートされています)
http://fukuno.jig.jp/app/IchigoJam/#10%20CLS%3ACLV%3AD%3D2%0A20%20INPUT%20P%0A25%20IF%20P%3E%3D32767%20OR%20P%3C%3D1%20THEN%20%3F%22OUT%20OF%20RANGE%22%3AEND%0A30%20IF%20X%3E%3DP%20THEN%20%3F%22SMALL%20OR%20SAME%22%3AEND%0A40%20IF%20D%3DP%20THEN%20GOTO%20100%0A50%20IF%20P%25D%3D0%20THEN%20%3F%22NOT%20SOSU%22%3A%3F%22SCORE%3A%22%3BX%3AEND%0A60%20D%3DD%2B1%0A70%20GOTO%2040%0A100%20X%3DP%3AD%3D2%3AGOTO%2020%0A

5
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?