Q BASIC PROGRAM TO CHECK WHETHER THE GIVEN NUMBER IS PERFECT SQUARE OR NOT. FUNCTION
DECLARE FUNCTION CHECK$(N)
CLS
INPUT "ENTER ANY NUMBER";N
PRINT CHECK$(N)
END
FUNCTION CHECK$(N)
A=SQR(N)
B=INT(A)
IF A=B THEN
C$="PERFECT SQUARE"
ELSE
C$="NOT PERFECT SQUARE"
END IF
CHECK$=C$
ENS FUNCTION
Search This Blog
Wikipedia
Search results
Tuesday, October 1, 2019
Q BASIC PROGRAM:DISPLAY 1,2,3,5,8......UP TO 13 TERM
Q BASIC PROGRAM TO DISPLAY 1,2,3,5,8...........UP TO 13 TERM. SUB
DECLARE SUB SERIES()
CLS
CALL SERIES
END
SUB SERIES()
A=1
B=2
FOR I =1 TO 13
PRINT A;
C=A+B
A=B
B=C
NEXT I
END SUB
DECLARE SUB SERIES()
CLS
CALL SERIES
END
SUB SERIES()
A=1
B=2
FOR I =1 TO 13
PRINT A;
C=A+B
A=B
B=C
NEXT I
END SUB
Q BASIC PROGRAM:POSITIVE NEGATIVE OR ZERO
Q BASIC PROGRAM TO CHECK WHETHER THE GIVEN NO IS POSITIVE NEGATIVE OR NEUTRAL NUMBER. SUB
DECLARE SUB CHECK(N)
CLS
INPUT "ENTER ANY NUMBER";N
CALL CHECK(N)
END
SUB CHECK(N)
IF N>0 THEN
PRINT "POSITIVE NUMBER"
ELSE
IF N<0 THEN
PRINT "NEGATIVE NUMBER"
ELSE
PRINT "NEUTRAL NUMBER"
END IF
END SUB
DECLARE SUB CHECK(N)
CLS
INPUT "ENTER ANY NUMBER";N
CALL CHECK(N)
END
SUB CHECK(N)
IF N>0 THEN
PRINT "POSITIVE NUMBER"
ELSE
IF N<0 THEN
PRINT "NEGATIVE NUMBER"
ELSE
PRINT "NEUTRAL NUMBER"
END IF
END SUB
Q BASIC PROGRAM:DISPLAY CONSONANT ONLY
Q BASIC PROGRAM TO ERASE VOWELS FROM THE STRING. FUNCTION
DECLARE FUNCTION ERASE(A$)
CLS
INPUT "ENTER ANY STRING";A$
PRINT "STRING WITHOUT VOWELS=" ;ERASE(A$)
END
FUNCTION ERASE(A$)
B$=UCASE$(A)
FOR I = 1 TO LEN(B$)
C$=MID$(B$,I,1)
IF C$<>"A" AND C$<>"E" AND C$<>"I" AND C$<>"O" AND C$<>"U" THEN D$=D$+1
END IF
NEXT I
ERASE = D$
END FUNCTION
DECLARE FUNCTION ERASE(A$)
CLS
INPUT "ENTER ANY STRING";A$
PRINT "STRING WITHOUT VOWELS=" ;ERASE(A$)
END
FUNCTION ERASE(A$)
B$=UCASE$(A)
FOR I = 1 TO LEN(B$)
C$=MID$(B$,I,1)
IF C$<>"A" AND C$<>"E" AND C$<>"I" AND C$<>"O" AND C$<>"U" THEN D$=D$+1
END IF
NEXT I
ERASE = D$
END FUNCTION
Q BASIC PROGRAM:CAPITAL OR SMALL
Q BASIC PROGRAM TO CHECK INPUT CHARACTER IS CAPITAL OR SMALL. FUNCTION
DECLARE FUNCTION CHECK$(N$)
CLS
INPUT "ENTER ANY STRING";N$
IF C$=N$ THEN
PRINT "CAPITAL CHARACTER"
ELSE
PRINT "SMALL CHARACTER"
END
FUNCTION CHECK$(N$)
FOR I=1 TO LEN(N$)
B$=MID$(N$,I,1)
C$=UCASE$(B$)
NEXT I
END FUNCTION
DECLARE FUNCTION CHECK$(N$)
CLS
INPUT "ENTER ANY STRING";N$
IF C$=N$ THEN
PRINT "CAPITAL CHARACTER"
ELSE
PRINT "SMALL CHARACTER"
END
FUNCTION CHECK$(N$)
FOR I=1 TO LEN(N$)
B$=MID$(N$,I,1)
C$=UCASE$(B$)
NEXT I
END FUNCTION
Q BASIC PROGRAM:TO DISPLAY50,42,35,29,24....UP TO 10TH TERM
Q BASIC PROGRAM TO DISPLAY 50,42,35,29,24....UP TO 10 TERM.SUB
DECLARE SUB SERIES()
CLS
CALL SERIES
END
SUB SERIES()
A=50
B=8
FOR I =1 TO 10
PRINT A
A=A-B
B=B-1
NEXT I
END SUB
DECLARE SUB SERIES()
CLS
CALL SERIES
END
SUB SERIES()
A=50
B=8
FOR I =1 TO 10
PRINT A
A=A-B
B=B-1
NEXT I
END SUB
Q BASIC PROGRAM: PALINDROME WORD
Q BASIC PROGRAM TO CHECK WHETHER THE GIVEN WORD IS PALINDROME OR NOT. FUNCTION
DECLARE FUNCTION PAL$(N$)
CLS
INPUT "ENTER ANY WORD";N$
P=PAL$(N$)
P=N THEN
PRINT "PALINDROME WORD"
ELSE
PRINT "NOT PALINDROME NUMBER"
END IF
END
FUNCTION PAL$(N$)
FOR I = LEN(N$) TO 1 STEP -1
B$=MID$(N$,I,1)
C$=C$+B$
NEXT I
PAL$=C$
END FUNCTION
DECLARE FUNCTION PAL$(N$)
CLS
INPUT "ENTER ANY WORD";N$
P=PAL$(N$)
P=N THEN
PRINT "PALINDROME WORD"
ELSE
PRINT "NOT PALINDROME NUMBER"
END IF
END
FUNCTION PAL$(N$)
FOR I = LEN(N$) TO 1 STEP -1
B$=MID$(N$,I,1)
C$=C$+B$
NEXT I
PAL$=C$
END FUNCTION
Q BASIC PROGRAM:PRIME OR COMPOSITE
Q BASIC PROGRAM TO CHECK THE GIVEN NO IS PRIME OR COMPOSITE. SUB
DECLARE SUB CHECK(N)
CLS
INPUT "ENTER ANY NUMBER ";N
CALL CHECK(N)
END
SUB CHECK(N)
C=0
FOR I = 1 TO N
IF N MOD I=0 THEN C=C+1
NEXT I
IF C=2 THEN
PRINT "NO IS PRIME"
ELSE
PRINT "NO IS COMPOSITE"
END IF
END SUB
DECLARE SUB CHECK(N)
CLS
INPUT "ENTER ANY NUMBER ";N
CALL CHECK(N)
END
SUB CHECK(N)
C=0
FOR I = 1 TO N
IF N MOD I=0 THEN C=C+1
NEXT I
IF C=2 THEN
PRINT "NO IS PRIME"
ELSE
PRINT "NO IS COMPOSITE"
END IF
END SUB
FACTORIAL
Q BASIC PROGRAM TO PRINT FACTORIAL OF A GIVEN NUMBER. FUNCTION
DECLARE FUNCTION FACT(N)
CLS
INPUT "ENTER ANY NUMBER";N
PRINT "FACTORIAL=";FACT(N)
END
FUNCTION FACT(N)
F=1
FOR I = 1 TO N
F=F*I
NEXT I
FACT = F
END FUNCTION
DECLARE FUNCTION FACT(N)
CLS
INPUT "ENTER ANY NUMBER";N
PRINT "FACTORIAL=";FACT(N)
END
FUNCTION FACT(N)
F=1
FOR I = 1 TO N
F=F*I
NEXT I
FACT = F
END FUNCTION
Q BASIC PROGRAM TO FIND GREATEST AMONG THREE NUMBERS. SUB
DECLARE SUB GREAT(A,B,C)
CLS
INPUT "ENTER ANY 3 NUMBERS";A,B,C
CALL GREAT (A,B,C)
END
SUB GREAT(A,B,C)
IF A>B AND A>C THEN
PRINT "GREATEST NUMBER IS";A
ELSEIF B>A AND B>C THEN
PRINT "GREATEST NUMBER IS";B
ELSE
PRINT "GREATEST NUMBER IS";C
END IF
END SUB
DECLARE SUB GREAT(A,B,C)
CLS
INPUT "ENTER ANY 3 NUMBERS";A,B,C
CALL GREAT (A,B,C)
END
SUB GREAT(A,B,C)
IF A>B AND A>C THEN
PRINT "GREATEST NUMBER IS";A
ELSEIF B>A AND B>C THEN
PRINT "GREATEST NUMBER IS";B
ELSE
PRINT "GREATEST NUMBER IS";C
END IF
END SUB
QBasic program to count total no of consonant in given word. FUNCTION
DECLARE FUNCTION COUNT(N$)
CLS
INPUT "ENTER ANY STRING";N$
PRINT"TOTAL NO OF CONSONANT IS";COUNT(N$)
END
FUNCTION COUNT(N$)
C=0
C=0
FOR I =1 TO LEN(N$)
B$=MID$(N$,I,1)
C$=UCASE$(B$)
IF C$<>"A" OR C$<>"E" OR C$<>"I" OR C$<>"O" OR C$<>"U" THEN C<>C+1
NEXT I
COUNT=C
COUNT=C
END SUB
QBasic program to count total no of vowels in given word. FUNCTION
DECLARE FUNCTION COUNT(N$)
CLS
INPUT "ENTER ANY STRING";N$
PRINT"TOTAL NO OF VOWEL IS";COUNT(N$)
END
FUNCTION COUNT(N$)
C=0
C=0
FOR I =1 TO LEN(N$)
B$=MID$(N$,I,1)
C$=UCASE$(B$)
IF C$="A" OR C$="E" OR C$="I" OR C$="O" OR C$="U" THEN C=C+1
NEXT I
COUNT=C
COUNT=C
END SUB
Subscribe to:
Posts (Atom)
Journey of Jagat Mandir H. S. School When I was at the age of three I joined the school in the village. When I came to K...
-
Q BASIC PROGRAM TO FIND AREA OF BOX. FUNCTION DECLARE FUNCTION AREA(L,B,H) CLS INPUT "ENTER LENGTH";L INPUT "ENTER BREAD...
-
MY FATHER My Father name is LOK RAJ PANERU. He is thirty nine year old. He was born in Kailali, Dhanghadi. He rade up to class ten. He ...
-
GAI JATRA 2075/18 Gai Jatra is a type of festival which is only celebrated in Nepal. Gai means cow and jatra means festival. Gai Jatra is...