CLS
INPUT "Test Number: ";N
'f is flag which is set to 0 indicating testing number is prime and 1 indicating testing number is composite
F=0
FOR I=2 TO N/2
IF N MOD I=0 THEN
F=1
EXIT FOR
ENDIF
NEXT I
IF F=0 THEN
PRINT N;" IS PRIME NUMBER"
ELSE
PRINT N;" IS COMPOSITE NUMBER"
ENDIF
vogus
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteDECLARE FUNCTION a (n)
ReplyDeleteCLS
g = a(n)
END
FUNCTION a (n)
INPUT "enter a no:", n
FOR i = 1 TO n
b = n MOD i
IF b = 0 THEN f = f + 1
NEXT i
IF f > 2 THEN
PRINT "composite "
ELSE
PRINT "Prime"
END IF
END FUNCTION
Wat is f?
ReplyDeletef is local variable used for storing value or remainder of b...
Deletewap to get a name from user and print out the initial characters of each word
ReplyDeletehow to find reverse of string word
ReplyDeleteCls
DeleteInput A$
L=len (A$)
For I=L to 1 step -1.(no dot)
b$=b$+mid$(a$,i,1)
Next I
Print b$
End