0% found this document useful (0 votes)
141 views7 pages

Solved QBasic Programs For Students

This document contains 19 solved QBasic programs for students. The programs demonstrate basic programming concepts like string manipulation, loops, printing, and calculating sums. They provide examples of using commands like LEFT, MID, RIGHT, PRINT, FOR/NEXT loops, and LET to perform simple string operations and numeric calculations.

Uploaded by

Sidharth Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
141 views7 pages

Solved QBasic Programs For Students

This document contains 19 solved QBasic programs for students. The programs demonstrate basic programming concepts like string manipulation, loops, printing, and calculating sums. They provide examples of using commands like LEFT, MID, RIGHT, PRINT, FOR/NEXT loops, and LET to perform simple string operations and numeric calculations.

Uploaded by

Sidharth Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Solved QBasic Programs for students. http://www.udaipurplus.com/kids/basic_progs4.

htm

PAGE - 4

CLS Home Page


A$ = "RAMAN" Hotels & Resorts
B$ = "NARAYANAN" Marble
C$ = "MAN"
D$ = LEFT$(A$, 3) Industries
E$ = MID$(B$, 4, 4) Hospital &
F$ = MID$(C$, 2, 2) Doctor
G$ = D$ + E$ + F$ Handicrafts
PRINT G$ Jewellers
END
Restaurant / Bar
2
Schools / Colleges
CLS
A$ = "RAMAN" Computer
B$ = "NARAYANAN" Institue
C$ = "MAN" Business Listing
D$ = LEFT$(A$, 3) Classifieds
E$ = MID$(B$, 4, 4)
F$ = MID$(C$, 2, 2)
G$ = D$ + E$ + F$ What's New ?
PRINT G$ Kids Corner
REM FOLLOWING STEPS ARE TO EXPLAIN THE COMMANDS Out & About
PRINT A$, "LEFT 3" Udaipur
PRINT B$, "MID 4 4" Visitors to
PRINT C$, "MID 2 2" Udaipur
END

3 Useful websites
REM SUM OF FIRST 100 ODD NUMBERS
CLS NetTalk

1 of 7 9/13/2017, 11:20 AM
Solved QBasic Programs for students. http://www.udaipurplus.com/kids/basic_progs4.htm

SUM = 0 Thoughts of day


FOR F = 1 TO 100
LET SUM = SUM + 2 * F - 1 Personalities
NEXT F
PRINT SUM
END
Yellow Pages
4

REM REPEATED PROG Paintings


CLS Photo Gallary
LET Q$ = "RAJAT"
Cricket
LET W$ = RIGHT$(Q$, 2)
PRINT W$ Cartoon corner
END News
5
Online directory
REM INSERT SPACE BETWEEN TWO STRINGS
CLS Weather
INPUT " ENTER ANY STRING"; A$
V$ = LEFT$(A$, 11)
Suggest this site
C$ = " "
D$ = RIGHT$(A$, 13) Contact
F$ = V$ + C$ + D$
PRINT F$
END

REM MODIFYING A STRING


CLS
P$ = "PROGRAMMING IN BASIC IS INTERESTING"
V$ = LEFT$(P$, 11)
C$ = " "
D$ = RIGHT$(P$, 14)
F$ = V$ + C$ + D$
PRINT F$
END

CLS
FOR I = 100 TO 1 STEP -1
FOR J = 100 TO I
PRINT J

2 of 7 9/13/2017, 11:20 AM
Solved QBasic Programs for students. http://www.udaipurplus.com/kids/basic_progs4.htm

NEXT J
PRINT
NEXTI
END
PRINT I;
SUM = SUM + 1
NEXT I
PRINT SUM
END

CLS
FOR I = 1 TO 5
FOR j = 1 TO I
PRINT "*";
NEXT j
PRINT
NEXT I
FOR I = 4 TO 1 STEP -1
FOR j = 1 TO I
PRINT "*";
NEXT j
PRINT
NEXT I
END

CLS
SCREEN 1
FOR I = 1 TO 150
CIRCLE (100 + I, 100), 56
CIRCLE (100 + I, 100), 50
NEXT I
PRINT " RUPAL is best CHILLA"
END

10

REM SUM OF ODD NOS.


CLS
SUM = 0
FOR I = 1 TO 100
LET A = 2 * I - 1
LET SUM = SUM + A

3 of 7 9/13/2017, 11:20 AM
Solved QBasic Programs for students. http://www.udaipurplus.com/kids/basic_progs4.htm

REM CHECK WHY THIS PROG WAS NAMED SQUAODD?


NEXT I
PRINT " SUM"; SUM
END

11

REM SUM OF FIRST N ODD NOS., SUM OF SQU OF FIRST N ODD NOS..?
CLS
SUM = 0
FOR I = 1 TO 10
LET A = 2 * I - 1
LET A = A * A
LET SUM = SUM + A
PRINT A, SUM
NEXT I
PRINT " SUM"; SUM
END

12

REM THIS IS SQUARE OF ODDS NOT EVEN


CLS
SUM = 0
FOR F = 1 TO 100
LET X = 2 * F - 1
LET D = X * X
PRINT D;
NEXT F
END

13

REM TAKE A NUMBER, SQUARE IT


CLS
SUM = 0
FOR F = 1 TO 10
LET X = 2 * F - 1
LET D = X * X
SUM = SUM + D
PRINT F, X, D, SUM
NEXT F
PRINT
PRINT "SUM OF FIRST 10 EVEN SQUARES IS", SUM
END

4 of 7 9/13/2017, 11:20 AM
Solved QBasic Programs for students. http://www.udaipurplus.com/kids/basic_progs4.htm

14

FOR I = 1 TO 5
FOR J = 1 TO I
PRINT "*";
NEXT J
PRINT
NEXT I
FOR I = 4 TO 1 STEP -1
FOR J = 1 TO I
PRINT "*";
NEXT J
PRINT
NEXT I
END

15

REM MODIFYING STRING


CLS
C$ = "STAND OPPOSITE TO HIM"
D$ = LEFT$(C$, 2)
E$ = MID$(C$, 7, 2)
F$ = RIGHT$(C$, 4)
G$ = D$ + E$ + F$
PRINT G$
END

16

REM SUM OF FIRST 100 NOS.


CLS
SUM = 0
FOR F = 1 TO 100
PRINT "NO. IS "; F
LET SUM = SUM + F
NEXT F
PRINT "SUM"; SUM
END

17

REM REPEATED
CLS
SUM = 0
FOR F = 1 TO 100

5 of 7 9/13/2017, 11:20 AM
Solved QBasic Programs for students. http://www.udaipurplus.com/kids/basic_progs4.htm

PRINT F
SUM = SUM + F
NEXT F
PRINT "THE SUM"; SUM
END

18

REM REPEATED..EXPERIMENTING WITH COMMANDS


CLS
LET Q$ = "SUMAN IS A NICE GIRL"
PRINT LEFT$(Q$, 5)
PRINT LEFT$(Q$, 10)
PRINT RIGHT$(Q$, 4)
PRINT RIGHT$(Q$, 9)
PRINT MID$(Q$, 12, 4)
END

19

REM THE NAME IS INCORRCT. PROG GIVES SUM OF FIRST 10 ODD NUMBERS
CLS
SUM = 0
FOR I = 1 TO 10
LET X = 2 * I - 1
SUM = SUM + X
PRINT " ODD NUMBER AT POSITION"; I; "IS"; X
NEXT I
PRINT "TOTAL SUM", SUM
END

20

REM SUM OF EVEN NUMBERS IN FIRST 10 NATURAL NUMBERS


CLS
SUM = 0
FOR F = 10 TO 1 STEP -2
SUM = SUM + F
PRINT F, SUM
NEXT F
PRINT " SUM"; SUM
END

6 of 7 9/13/2017, 11:20 AM
Solved QBasic Programs for students. http://www.udaipurplus.com/kids/basic_progs4.htm

MORE PROGRAMS

Send such programs if you have

7 of 7 9/13/2017, 11:20 AM

You might also like