Connect Me

twitterfacebookgoogle plus email

  Instagram View Biwas Bhattarai's profile on LinkedIn
Showing posts with label SEE Exam Computer Science. Show all posts
Showing posts with label SEE Exam Computer Science. Show all posts

WAP using SUB procedure to enter a string and print the characters of even position only. (Example: KATHMANDU, output is AHAD)

WAP using SUB procedure to enter a string and print the characters of even position only. (Example: KATHMANDU, output is AHAD)

DECLARE SUB EVEN(E$)
CLS
INPUT "INPUT A WORD/STRING";E$
CALL EVEN(E$)
END

SUB EVEN(E$)
FOR I=1 TO LEN(E$)
F$=MID$(E$,I,1)
IF I MOD 2=0 THEN PRINT F$;
NEXT I
END SUB

WAP to enter a number from a keyboard and check and print whether the number is PRIME or COMPOSITE.

DECLARE SUB PRCOM(N)
CLS
INPUT "ENTER A NUMBER"; N
CALL PRCOM(N)
END

SUB PRCOM(N)
FOR I=1 TO N
IF N MOD I=0 THEN C=C+1
NEXT I
IF C=2 THEN 
PRINT "SUPPLIED NUMBER IS A PRIME NUMBER"
ELSE
PRINT "SUPPLIED NUMBER IS A COMPOSITE NUMBER"
END IF
END SUB
Ą
https://www.flickr.com/photos/spklg/15211044551/