Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
1
Help us understand the problem. What is going on with this article?
@hakatamax

IchigoJamで素数ゲーム

More than 3 years have passed since last update.

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

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

■概要
自分より小さな数で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

1
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
1
Help us understand the problem. What is going on with this article?