怎么写编程?Basic语言。
答案:2 悬赏:30 手机版
解决时间 2021-11-11 18:12
- 提问者网友:雨不眠的下
- 2021-11-11 04:11
怎么写编程?Basic语言。
最佳答案
- 五星知识达人网友:舊物识亽
- 2021-11-11 04:52
不知道你用的什么Basic,是QBasic、小霸王学习机上的FBasic、还是Visual Basic,三种都写出来吧
rem QBasic
print "Please input N:"
input N
for I = 2 to N - 1
R = N mod I
if R = 0 then goto YES
next
NO:
print "NO"
end
YES:
print "YES"
end
REM FBasic
PRINT "Please input N:"
INPUT N
I = 2
LOOPI:
R = N MOD I
IF R = 0 THEN GOTO YES
I = I + 1
IF I > N - 1 THEN GOTO LOOPI
NO:
PRINT "NO"
END
YES:
PRINT "YES"
END
'VB
dim i, n, r
n = inputbox ("请输入N")
for i = 2 to n - 1
r = n mod i
if r = 0 then
msgbox "YES"
end
end if
next
msgbox "NO"
rem QBasic
print "Please input N:"
input N
for I = 2 to N - 1
R = N mod I
if R = 0 then goto YES
next
NO:
print "NO"
end
YES:
print "YES"
end
REM FBasic
PRINT "Please input N:"
INPUT N
I = 2
LOOPI:
R = N MOD I
IF R = 0 THEN GOTO YES
I = I + 1
IF I > N - 1 THEN GOTO LOOPI
NO:
PRINT "NO"
END
YES:
PRINT "YES"
END
'VB
dim i, n, r
n = inputbox ("请输入N")
for i = 2 to n - 1
r = n mod i
if r = 0 then
msgbox "YES"
end
end if
next
msgbox "NO"
全部回答
- 1楼网友:纵马山川剑自提
- 2021-11-11 05:21
INPUT n, i
r=n MOD i
DO
IF r=0 THEN
PRINT "Yes"
END
ELSE
i = i + 1
END IF
UNTIL i > n - 1
PRINT "No"
r=n MOD i
DO
IF r=0 THEN
PRINT "Yes"
END
ELSE
i = i + 1
END IF
UNTIL i > n - 1
PRINT "No"
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯