Share PDF

Search documents:
  Report this document  
    Download as PDF   
      Share on Facebook

GW Basic Practical

PRACTICAL-1

OBJECT: Write a generalized program to prepare Bio-data.

START

10

REM * PROGRAM TO PREPARE BIO-DATA *

 

20

CLS

 

 

INPUT; N$

30

INPUT “ENTER YOUR GOOD NAME ------

”; N$

INPUT; F$

40

INPUT “ENTER YOUR FATHER’S NAME- ”; F$

50

INPUT “ENTER YOUR SEX-------------------

 

”; S$

INPUT; S$

60

INPUT “ENTER YOUR DATE OF BIRTH---

”; D$

70

INPUT “ENTER YOUR QUALIFICATION--

”; Q$

INPUT; D$

60

INPUT “ENTER YOUR RELIGION-----------

”; R$

70

INPUT “ENTER YOUR NATIONALITY-----

”; NA$

INPUT; Q$

80

CLS

 

 

90

PRINT TAB(30)“B I O – D A T A”

 

INPUT; R$

100 PRINT TAB(30)“--------------------

”

 

110 PRINT

 

 

INPUT; NA$

120 PRINT TAB(20)“YOUR GOOD NAME ------

”; N$

130 PRINT TAB(20)“YOUR FATHER’S NAME- ”; F$

PRINT; N$

140 PRINT TAB(20)“YOUR SEX-------------------

 

”; S$

150 PRINT TAB(20)“YOUR DATE OF BIRTH

”; D$

 

PRINT; F$

160 PRINT TAB(20)“YOUR QUALIFICATION--

”; Q$

170 INPUT TAB(20)“YOUR RELIGION

”; R$

 

PRINT; S$

180 INPUT TAB(20)“YOUR NATIONALITY-----

”;NA$

190 END

 

 

 

 

 

PRINT; D$

 

 

 

 

PRINT; Q$

 

 

 

 

PRINT; R$

 

 

 

 

PRINT; NA$

 

 

 

 

END

 

 

 

 

 

 

 

 

 

GW Basic Practical

PRACTICAL-2

OBJECT: Write a program to print your name ten times by using.

(a) FOR-NEXT Statement

 

(b) IF-THEN Statement

 

 

 

 

 

(a) By using FOR-NEXT Statement

 

 

 

START

 

10

REM * PROGRAM TO PRINT YOUR NAME TEN TIMES *

 

 

20

CLS

 

 

 

 

 

 

30

INPUT “ENTER YOUR GOOD NAME ========>”; N$

 

INPUT; N$

 

40

CLS

 

 

50

PRINT TAB(25)“PRINTING OF NAME TEN TIMES”

 

 

 

 

 

 

60

PRINT TAB(23)“BY USING FOR-NEXT STATEMENT”

 

FOR A = 1 TO 10

 

70

PRINT TAB(25)“~~~~~~~~~~~~~~~~~~~~~~~~~~~~~”

 

 

 

 

80 FOR A = 1 TO 10

 

 

 

90

PRINT TAB(38); A; N$

 

 

 

 

 

 

100 NEXT A

 

PRINT; N$

 

110 END

 

NEXT A

 

 

 

 

END

 

 

 

 

 

 

 

 

 

 

 

 

(b) By using IF-THEN Statement

 

 

 

START

 

10

REM * PROGRAM TO PRINT YOUR NAME TEN TIMES *

 

 

20

CLS

 

 

 

 

 

 

30

INPUT “ENTER YOUR GOOD NAME ========>”; N$

 

INPUT; N$

 

40

CLS

 

 

50

PRINT TAB(25)“PRINTING OF NAME TEN TIMES”

 

 

 

C

 

60 PRINT TAB(25)“BY USING IF-THEN STATEMENT”

 

A = A + 1

 

70

PRINT TAB(25)“~~~~~~~~~~~~~~~~~~~~~~~~~~~~”

 

 

80 A = A + 1

 

 

 

90

PRINT TAB(38); A; N$

 

 

 

100 IF A = 10 THEN END ELSE 80

 

PRINT A; N$

 

 

 

 

NO

 

 

 

 

IS A = 10

C

 

 

 

YES

 

 

 

 

END

 

 

 

 

 

 

 

 

GW Basic Practical

PRACTICAL-3

OBJECT: Write a program to calculate Square and Cube of first Ten Natural Numbers

 

START

10

REM * PROGRAM TO CALCULATE SQUARE AND CUBES *

 

20

CLS

 

 

 

 

 

 

30

PRINT “NUMBERS”, “SQUARE”, “CUBE”

 

FOR N = 1 TO 10

 

40

PRINT “~~~~~~~~~”, “~~~~~~~~”, “~~~~”

 

 

50

FOR N = 1 TO 10

 

 

 

 

 

 

60

PRINT N, N^2, N^3

 

PRINT N, N^2, N^3

70

NEXT N

 

80 PRINT STRING$(35, “~”)

 

 

 

90

END

 

NEXT N

 

 

 

END

 

 

 

 

 

 

 

PRACTICAL-4

OBJECT: Write a program to produce the sum of first Ten Natural Numbers

START

FOR N = 1 TO 10

SUM = SUM + N

PRINT ; N

NEXT N

PRINT ; SUM

END

10 REM * PROGRAM TO PRODUCE SUM OF NUMBERS * 20 CLS

30 PRINT “NUMBERS”

40 PRINT “~~~~~~~~~”

50 FOR N = 1 TO 10

60 SUM = SUM + N

70 PRINT N

80 NEXT N

90 PRINT TAB(30); “---------“

100 PRINT “SUM OF FIRST TEN NATURAL NUMBERS IS “;SUM 110 PRINT TAB(30); “---------“

GW Basic Practical

PRACTICAL-5

OBJECT: Write a program to the numbers 13,8,28,18,23,3 in

(a) Ascending Order

(b)

Descending Order

 

 

 

 

 

 

 

 

(a) Ascending Order

 

 

 

 

 

 

 

 

 

 

10

REM * PROGRAM TO ARRANGE NUMBERS *

 

START

 

 

 

20 CLS

 

 

 

 

 

30

PRINT TAB(25)“NUMBERS IN ASCENDING ORDER”

 

 

 

 

 

40

PRINT TAB(25)“~~~~~~~~~~~~~~~~~~~~~~~~~~~~~”

 

 

 

 

 

 

FOR A = 3 TO 28 STEP 5

 

 

50 FOR A = 3 TO 28 STEP 5

 

 

 

 

 

60

PRINT TAB(38); A

 

 

 

 

 

 

 

 

 

 

70

NEXT A

 

PRINT ; A

 

 

 

80

PRINT TAB(25) STRING$(26, “~”)

 

 

 

 

90

END

 

 

 

 

 

 

NEXT A

 

 

 

 

 

 

END

 

 

 

 

 

 

 

 

 

 

 

 

 

(b) Descending Order

 

 

 

 

 

10

REM * PROGRAM TO ARRANGE NUMBERS *

 

START

20 CLS

 

 

 

30

PRINT TAB(25)“NUMBERS IN DESCENDING ORDER”

 

 

 

40

PRINT TAB(25)“~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~”

 

 

 

 

FOR D = 28 TO 3 STEP -5

 

50 FOR D = 28 TO 3 STEP -5

 

 

 

60

PRINT TAB(38); D

 

 

 

 

 

 

70

NEXT D

 

PRINT ; D

80

PRINT TAB(25) STRING$(26, “~”)

 

90

END

 

 

 

 

NEXT D

 

 

 

END

 

 

 

 

 

 

 

GW Basic Practical

PRACTICAL-6 (a)

OBJECT: Write a generalized program to prepare a Multiplication Table up till ten times

START

INPUT; N

FOR M = 1 TO 10

NEXT M

END

10 REM * PROGRAM TO PREPARE MULTIPLICATION TABLE *

20 CLS

30 INPUT “NUMBER FOR TABLE”; N

40 CLS

50 PRINT “TABLE OF ……………:”; N

60 PRINT

70 FOR M = 1 TO 10

80 PRINT N; “*”; M; “ = “; N * M 90 NEXT M

100 END

PRACTICAL-6 (b)

OBJECT: Write a generalized program to find the Average of given four numbers.

START

INPUT; N1

INPUT; N2

INPUT; N3

INPUT; N4

AVG=(N1+N2+N3+N4)/4

PRINT; N1

PRINT; N2

PRINT; N3

PRINT; N4

PRINT; AVG

10

REM * PROGRAM TO FIND THE AVERAGE OF NUMBERS *

20

CLS

 

30

INPUT “ENTER FIRST NUMBER-----------

”; N1

40

INPUT “ENTER SECOND NUMBER-------

”; N2

50

INPUT “ENTER THIRD NUMBER----------

”; N3

60

INPUT “ENTER FOURTH NUMBER-------

”; N4

70

AVG = (N1 + N2 + N3 + N4) / 4

 

80

PRINT TAB(25)“FIRST NUMBER---------------

”; N1

90

PRINT TAB(25)“SECOND NUMBER-----------

”; N2

100

PRINT TAB(25)“THIRD NUMBER--------------

”; N3

110

PRINT TAB(25)“FOURTH NUMBER-----------

”; N4

120

PRINT

 

130

PRINT TAB(25)“AVERAGE OF FOUR NUMBERS----“; AVG

140

END

 

END

GW Basic Practical

PRACTICAL-7

OBJECT: Write a generalized program to Convert.

(a) Fahrenheit into Centigrade

(b) Centigrade into Fahrenheit

 

 

 

(a) Fahrenheit into Centigrade

 

 

START

10

REM * PROGRAM TO CONVERT TEMPERATURE *

20 CLS

 

30

INPUT “ENTER TEMPERATURE IN FAHRENHEIT___”; F

INPUT; F

40

C = 5 / 9 * (F-32)

50 CLS

 

60

PRINT ; F; “FAHRENHEIT IS EQUAL TO”; C; “CENTIGRADE”

 

70

END

C=5/9*(F-32)

 

 

PRINT F; C

 

 

END

 

 

 

 

 

(b) Centigrade into Fahrenheit

 

 

START

10

REM * PROGRAM TO CONVERT TEMPERATURE *

20 CLS

 

30

INPUT “ENTER TEMPERATURE IN CENTIGRADE ___”; C

INPUT; C

40

F = 9 / 5 * C + 32

50 CLS

 

60

PRINT ; C; “CENTIGRADE IS EQUAL TO”; F; “FAHRENHEIT”

 

70

END

F=9/5*C+32

 

 

PRINT C; F

 

 

END

 

 

 

 

 

GW Basic Practical

PRACTICAL-8

OBJECT: Write a generalized program to prepare Electricity Bill.

START

10

REM * PROGRAM TO PREPARE ELECTRICITY BILL *

 

20

CLS

INPUT; CN$

30

INPUT “ENTER CONSUMER NAME ------ ”; CN$

INPUT; MN$

40

INPUT “ENTER METER NUMBER--------- ”; MN$

50

INPUT “ENTER PREVIOUS READING---- ”; PV

INPUT; PV

60

INPUT “ENTER PRESENT READING------ ”; PR

70

UC = PR- PV

INPUT; PV

80

AMT = UC * 1.25

90

CLS

UC = PR - PV

100

PRINT TAB(30)“ELECTRICITY BILL”

110

PRINT TAB(30)“-------------------------- ”

AMT = UC * 1.25

120

PRINT

130 PRINT TAB(20)“CONSUMER NAME------ ”; CN$

PRINT; CN$

140

PRINT TAB(20)“METER NUMBER-------- ”; MN$

150 PRINT TAB(20)“PREVIOUS READING----“; PV

PRINT; MN$

160

PRINT TAB(20)“PRESENT READING------“; PR

170

PRINT : PRINT

 

PRINT; PV

180

PRINT TAB(20) “UNIT CONSUMED----------“; UC

190

PRINT TAB(20) “AMOUNT CHARGED------“; AMT

 

PRINT; PR

200

END

 

 

 

PRINT; UC

 

 

 

PRINT; AMT

 

 

 

END

 

 

 

 

 

 

 

GW Basic Practical

PRACTICAL-9

OBJECT: Write a generalized program to prepare an Employee’s Salary Sheet.

START

INPUT; EN$ INPUT; D$ INPUT; BS INPUT; TA INPUT; TD GS = BS + TA NS = GS - TD PRINT; EN$ PRINT; D$ PRINT; BS PRINT; TA PRINT; TD PRINT; GS PRINT; NS END

10

REM * PROGRAM TO PREPARE SALARY SHEET *

20

CLS

 

30

INPUT “ENTER EMPLOYEE’S NAME ----

”; EN$

40

INPUT “ENTER DESIGNATION------------

”; D$

50

INPUT “ENTER BASIC SALARY-----------

”; BS

60

INPUT “ENTER TOTAL ALLOWANCES--

”; TA

70

INPUT “ENTER TOTAL DEDUCTION-----

”; TD

80

GS = BS+ TA

 

90

NS = GS- TD

 

100

CLS

 

110

PRINT TAB(30)“EMPLOYEE’S SALARY SHEET”

120

PRINT TAB(30)“-----------------------------------------

”

130

PRINT

 

140

PRINT TAB(20)“EMPLOYEE’S NAME ----

”; EN$

150

PRINT TAB(20)“DESIGNATION------------

”; D$

160

PRINT TAB(20)“BASIC SALARY-----------

”; BS

170

PRINT TAB(20)“TOTAL ALLOWANCES--

”; TA

180

PRINT TAB(20)“TOTAL DEDUCTION-----

”; TD

190

PRINT : PRINT

 

210

PRINT TAB(20)“GROSS SALARY-----------

”; GS

220

PRINT TAB(20)“NET SALARY---------------

”; NS

230

END

 

GW Basic Practical

PRACTICAL-10

OBJECT: Write a generalized program to prepare a Marks sheet of Five subjects with Percentage.

START

INPUT; SN$

INPUT; RN

INPUT; E

INPUT; S

INPUT; C

INPUT; CH

INPUT; P

MO=E+S+C+CH+P

PER=(MO*100)/425

PRINT; SN$

PRINT; RN

PRINT; E

PRINT; S

PRINT; C

PRINT; CH

PRINT; P

PRINT; GS

PRINT; NS

END

10

REM * PROGRAM TO PREPARE MARKS SHEET *

20

CLS

 

 

 

30

INPUT “ENTER STUDENT’S NAME ------

”; SN$

40

INPUT “ENTER ROLL NUMBER

-----------

”; RN

50

INPUT “ENTER MARKS IN ENGLISH-----

”; E

60

INPUT “ENTER MARKS IN SINDHI--------

”; S

70

INPUT “ENTER MARKS IN COMP: STUD- ”; C

60

INPUT “ENTER MARKS IN CHEMISTRY--

 

”; CH

70

INPUT “ENTER MARKS IN PAK: STUD----

 

”; P

80 MO = E + S + C + CH + P

 

 

 

90

PER = (MO * 100) / 425

 

 

 

100

CLS

 

 

 

110

PRINT TAB(30)“MARKS SHEET”

 

 

120

PRINT TAB(30)“--------------------

”

 

 

130

PRINT

 

 

 

140

PRINT TAB(20)“STUDENT’S NAME ------

 

”; SN$

150

PRINT TAB(20)“ROLL NUMBER------------

 

”; RN

160

PRINT TAB(20)“MARKS IN ENGLISH--------

 

”; E

170

PRINT TAB(20)“MARKS IN SINDHI-----------

 

”; S

180

PRINT TAB(20)“MARKS IN COMP:STUD---

-”; C

190

INPUT TAB(20)“MARKS IN CHEMISTRY

---- ”; CH

200

INPUT TAB(20)“MARKS IN PAK: ------STUD

 

”; P

210

PRINT : PRINT

 

 

 

220

PRINT TAB(20)“MARKS OBTAINED-------------

 

”; MO

230

PRINT TAB(20)“PERCENTAGE--------------------

 

 

”; PER

240

END