Well Come to Professional Programmers

Learning Goal

Learning is a process to acquire, enhance, or make changes in one's knowledge. Learning Module presents essential and masks non-essential pieces of knowledge. It is self paced and presents required links to important examples and related terminologies essentially required for examination centric study. The module is focused on examination system in vogue in Pakistan and helps student acquire maximum marks in limited time of study.

Monday, April 12, 2010



Practical#1B



SOURCE PROGRAM



10 REM PRINT YOUR NAME TEN TIME BY USING IF..... THEN STATEMENT

20 CLS

30 INPUT "ENTER YOUR NAME:";N$

40 PRINT TAB(10) N$

50 LET A = A + 1

60 IF A = 10 THEN GOTO 70 ELSE GOTO 40

70 END




OUTPUT



GW-BASIC
GW-BASIC
GW-BASIC
GW-BASIC
GW-BASIC
GW-BASIC
GW-BASIC
GW-BASIC
GW-BASIC
GW-BASIC



Return to Top



Practical#2



SOURCE PROGRAM



10 REM CALCULATE SQUARE AND CUBE OF FIRST TEN NATURAL NUMBERS

20 CLS

30 PRINT TAB(5) "NUMBERS", "SQUARES", "CUBE"

40 FOR N = 1 TO 10

50 LET S = N^2

60 LET C = N^3

70 PRINT TAB(5) N, S, C

80 NEXT N

90 END



OUTPUT



NUMBERS SQUARES CUBE
1 1 1
2 4 8
3 9 27
4 16 64
5 25 125
6 36 216
7 49 343
8 64 512
9 81 729
10 100 1000




Return to Top



Practical#3A



SOURCE PROGRAM



10 REM PREPARE ANY MULTIPLICATION TABLE UPTILL 10 TIMES

20 CLS

30 INPUT "ENTER TABLE NUMBER";TAB

40 FOR N = 1 TO 10

50 PRINT TAB; " * "; N; "="; TAB * N

60 NEXT N

70 END




OUTPUT



2 * 1 = 2
2 * 2 = 4
2 * 3 = 6
2 * 4 = 8
2 * 5 = 10
2 * 6 = 12
2 * 7 = 14
2 * 8 = 16
2 * 9 = 18
2 * 10 = 20




Return to Top



Practical#3B



SOURCE PROGRAM



10 REM FIND OUT THE AVERAGE OF ANY FOUR 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 PRINT "THE GIVEN NUMBERS ARE:";N1; N2; N3; N4

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

90 PRINT "AVERAGE OF GIVEN FOUR NUMBERS = "; AVG

100 END



OUTPUT



THE GIVEN NUMBERS ARE: 5 10 7 14
AVERAGE OF GIVEN FOUR NUMBERS = 9




Return to Top



Practical#4A



SOURCE PROGRAM



10 REM GENERATE FOLLOWING NUMBERS IN ASCENDING ORDER

20 REM "13, 8, 18, 3, 23, 28 "

30 CLS

40 PRINT "NUMBERS IN ASCENDING ORDER"

50 FOR N = 3 TO 28 STEP 5

60 PRINT N

70 NEXT N



OUTPUT



NUMBERS IN ASCENDING ORDER
3
8
13
18
23
28




Return to Top



Practical#4B



SOURCE PROGRAM



10 REM GENERATE FOLLOWING NUMBERS IN ASCENDING ORDER

20 REM "13, 8, 18, 3, 23, 28"

30 CLS

40 PRINT "NUMBERS IN DESCENDING ORDER"

50 FOR N = 28 TO 3 STEP -5

60 PRINT N

70 NEXT N

80 END



OUTPUT



NUMBERS IN ASCENDING ORDER
28
23
18
13
8
3



Return to Top



Practical#05



SOURCE PROGRAM



10 REM TO PREPARE MARKS SHEET FOR 5 SUBJECTS WITH PERCENTAGE

20 CLS

30 INPUT "ENTER ROLL NUMBER";RN$

40 INPUT "ENTER STUDENT'S NAME";SN$

50 INPUT "ENTER FATHER'S NAME";FA$

60 INPUT "ENTER CLASS";CL$

70 INPUT "MARKS IN ENGLISH";E

80 INPUT "MARKS IN SINDHI";S

90 INPUT "MARKS IN PAKISTAN STUDIES";P

100 INPUT "MARKS IN CHEMISTRY";CH

110 INPUT "MARKS IN COMPUTER";CO

120 LET OBTMARKS = E + S + P + CH + CO

130 LET PER = (OBTMARKS / 425 ) * 100

140 PRINT TAB(10) "MARKS SHEET FOR 5 SUBJECTS WITH PERCENTAGE"

150 PRINT TAB(10) "STEP BY STEP SCHOOL"

160 PRINT "ROLL NUMBER:";RN

170 PRINT "STUDENT'S NAME:";SN$

180 PRINT "FATHER'S NAME:";FA$

190 PRINT "CLASS:";CL$

200 PRINT TAB(5) "SUBJECTS", "MAX.MARKS", "PASSING MARKS", "OBTAINED MARKS"

210 PRINT TAB(5) "ENGLISH", "75", "25", E

220 PRINT TAB(5) "SINDHI", "75", "25", S

230 PRINT TAB(5) "PAKISTAN STUDIES"; "75", "25", P

240 PRINT TAB(5) "CHEMISTRY", "100", "33", CH

250 PRINT TAB(5) "COMPUTER", "100", "33", CO

260 PRINT TAB(5) "TOTAL MARKS", "425", " ", OBTMARKS

270 PRINT TAB(10) "PERCENTAGE====",PER

280 END




OUTPUT




MARKS SHEET FOR 5 SUBJECTS WITH PERCENTAGE

STEP BY STEP SCHOOL

ROLL NUMBER: 12345
STUDENT'S NAME: ALI
FATHER'S NAME: AKHTAR
CLASS: IX

SUBJECTS MAX.MARKS PASSING MARKS OBTAINED MARKS
ENGLISH 75 25 45
SINDHI 75 25 49
PAKISTAN STUDIES75 25 58
CHEMISTRY 100 33 87
COMPUTER 100 33 95

TOTAL 425 334

PERCENTAGE==== 78.58823%





Return to Top



Practical#06



SOURCE PROGRAM




10 REM CONVERT DOLLARS INTO RUPEES AND RUPEES INTO DOLLARS

20 REM WHERE THE RATE IS 1$ = Rs.60

30 CLS

40 PRINT "TO CONVERT DOLLARS INTO RUPEES"

50 INPUT "ENTER VALUE IN DOLLARS($) =:";D

60 LET R = D * 60

70 PRINT D, "DOLLARS", "=="R, "RUPEES"

80 PRINT "TO CONVERT RUPEES INTO DOLLARS"

90 INPUT "ENTER VALUE IN RUPEES(Rs.) =:";R1

100 LET D1 = R1 / 60

110 PRINT R1, "RUPEES", "=="D1, "DOLLARS"

120 END



OUTPUT



500 DOLLARS == 30000 RUPEES
30000 RUPEES == 500 DOLLARS




Return to Top



Practical#07



SOURCE PROGRAM



10 REM TO CONVERT FAHRENHEIT INTO CENTIGRADE AND CENTIGRADE INTO FAHRENHEIT

20 CLS

30 PRINT "TO CONVERT FAHRENHEIT INTO CENTIGRADE"

40 INPUT "ENTER VALUE IN FAHRENHEIT";F

50 LET C = (5 / 9) * (F - 32)

60 PRINT F, "FAHRENHEIT", "===", C, "CENTIGRADE"

70 PRINT "***********************************************************"

80 PRINT "TO CONVERT CENTIGRADE INTO FAHRENHEIT"

90 INPUT "ENTER VALUE IN CENTIGRADE";C1

100 LET F1 = (9 / 5)*C1 + 32

110 PRINT C1, "CENTIGRADE","===", F1, "FAHRENHEIT"

120 END




OUTPUT



41 FAHRENHEIT === 5 CENTIGRADE
*****************************************************************
5 CENTIGRADE === 41 FAHRENHEIT



Return to Top



Practical#08



SOURCE PROGRAM



10 REM FIND THE TOTAL NUMBER OF MALE AND FEMALE STUDENTS

20 CLS

30 FOR A= 1 TO 10

40 INPUT "ENTER NAME";N$(A)

50 INPUT "ENTER SEX";S$(A)

60 NEXT A

70 PRINT "S.NO", "NAME", "SEX"

80 LET M=0 : F=0

90 FOR B = 1 TO 10

100 PRINT B, N$(B), S$(B)

110 IF LEFT$(S$(B),1) = "F" THEN F = F + 1 ELSE M = M + 1

120 NEXT B

130 PRINT "TOTAL NUMBER OF MALE STUDENTS=:";M

140 PRINT "TOTAL NUMBER OF FEMALE STUDENTS=:";F

150 END




OUTPUT



S.NO NAME SEX
1 ABRAR MALE
2 FARHAN MALE
3 FARHAT FEMALE
4 QADIR MALE
5 FARNAZ FEMALE
6 TARIQ MALE
7 ALI MALE
8 TOOBA FEMALE
9 SHOAKAT MALE
10 ARZOO FEMALE

TOTAL NUMBER OF MALE STUDENTS=: 6
TOTAL NUMBER OF FEMALE STUDENTS=: 4



Return to Top



Practical#09



SOURCE PROGRAM



10 REM TO PREPARE ELECTRICITY BILL

20 CLS

30 INPUT "ENTER METER NUMBER=:";MN$

40 INPUT "ENTER PREVIOUS READING=:";PR

50 INPUT "ENTER PRESENT READING=:";CR

60 LET U = CR - PR

70 LET A = U * 1.25

80 PRINT TAB(10) "ELECTRICITY BILL"

90 PRINT"*************************************************************"

100 PRINT "METER NUMBER=:",MN$

110 PRINT "PREVIOUS READING=:",PR

120 PRINT " PRESENT(Current Reading)READING=:",CR

130 PRINT "UNIT CONSUMED=:",U

140 PRINT "AMOUNT=:", A

150 END



OUTPUT



METER NUMBER=: AL - 12345
PREVIOUS READING=: 500
PRESENT(Current Reading) READING=:1000
UNIT CONSUMED=: 500
AMOUNT=: 625



Return to Top



Practical#10



SOURCE PROGRAM



10 REM TO PREPARE BIO DATA

20 CLS

30 INPUT "ENTER NAME";NA$

40 INPUT "ENTER FATHER'S NAME";FA$

50 INPUT "ENTER DATE OF BIRTH";BD$

60 INPUT "ENTER SEX";S$

70 INPUT "ENTER NATIONALITY";NT$

80 INPUT "ENTER QUALIFICATION";Q$

90 INPUT "ENTER RELIGION";R$

100 PRINT TAB(10) BIO DATA

110 PRINT "***********************************************"

120 PRINT "NAME",NA$

130 PRINT "FATHER'S NAME",FA$

140 PRINT "DATE OF BIRTH",BD$

150 PRINT "SEX",S$

160 PRINT "NATIONALITY",NT$

170 PRINT "QUALIFICATION",Q$

180 PRINT "RELIGION",R$

190 END



OUTPUT




BIO DATA

***********************************************
NAME ALI
FATHER'S NAME AKHTAR
DATE OF BIRTH 17- FEB - 1980
SEX MALE
NATIONALITY PAKISTANI
QUALIFICATION METRIC
RELIGION ISLAM




Return to Top



Practical#11



SOURCE PROGRAM



10 REM PRODUCE SUM OF FIRST 10 NATURAL NUMBERS

20 CLS

30 LET S = 0

40 FOR N = 1 TO 10

50 LET S = S + N

60 NEXT N

70 PRINT "THE SUM OF FIRST 10 NATURAL NUMBERS=:", S

80 END



OUTPUT



THE SUM OF FIRST 10 NATURAL NUMBERS=: 55



Return to Top



Practical#12



SOURCE PROGRAM



10 REM PREPARE EMPLOEE'S SALARY SHEET

20 CLS

30 INPUT "EMPLOYEE'S NAME";N$

40 INPUT "DESIGNATION";D$

50 INPUT "BASIC SALARY";BS

60 INPUT "TOTAL ALLOWANCES";TA

70 INPUT "TOTAL DEDUCTIONS";TD

80 LET TS = BS + TA - TD

90 PRINT TAB(10) "SALARY SHEET"

100 PRINT "****************************************************"

110 PRINT "EMPLOYEE'S NAME",N$

120 PRINT "DESIGNATION",D$

130 PRINT "BASIC SALARY",BS

140 PRINT "TOTAL ALLOWANCES",TA

150 PRINT "TOTAL DEDUCTIONS",TD

160 PRINT "*********************************************"

170 PRINT "TOTAL SALARY=:",TS

180 END



OUTPUT




SALARY SHEET

****************************************************
EMPLOYEE'S NAME FAROOQ
DESIGNATION MANAGER
BASIC SALARY 4250
TOTAL ALLOWANCES 1275
TOTAL DEDUCTIONS 370.5
********************************************
TOTAL SALARY=: 5154.5


Return to Top



Practical#13



SOURCE PROGRAM



10 REM FIND THE GREATER NUMBER OF ANY 3 GIVEN NUMBERS

20 CLS

30 INPUT "ENTER FIRST NUMBER=:";A

40 INPUT "ENTER SECOND NUMBER=:";B

50 INPUT "ENTER THIRD NUMBER=:";C

60 PRINT "THREE GIVEN NUMBERS ARE:",A,B,C

70 IF (A > B) AND (A > C) THEN PRINT "THE LARGEST NUMBER IS =:",A

80 IF (B > A) AND (B > C) THEN PRINT "THE LARGEST NUMBER IS =:",B

90 IF (C > A) AND (C > B) THEN PRINT "THE LARGEST NUMBER IS =:",C

100 END



OUTPUT



THREE GIVEN NUMBERS ARE: 5 4 9

THE LARGEST NUMBER IS =: 9


Return to Top



Practical#14



SOURCE PROGRAM




10 REM DRAW THE OLYMPIC CIRCLES

20 CLS

30 SCREEN 1

40 CLS

50 CIRCLE(115,75),35

60 PAINT(115,75)

70 CIRCLE(185,75),35

80 PAINT(185,75)

90 CIRCLE(255,75),35

100 PAINT(255,75)

110 CIRCLE(150,100),35

120 PAINT(150,100)

130 CIRCLE(210,100),35

140 PAINT(210,100)

150 LOCATE 20,17 : PRINT "OLYMPIC CIRCLES"

160 END


OUTPUT





Return to Top



Practical#15



SOURCE PROGRAM



10 REM DRAW THE FOLOWING GEOMETRICAL SHAPES

20 REM TRIANGLE, HEXAGONE AND RECTANGLE

30 CLS

40 SCREEN 1

50 DRAW "BU50BL140"

60 DRAW "E40F40L80"

70 DRAW "BU40BR100"

80 DRAW "R50F25G25L50H25E25"

90 LINE(200,20) - (300,60), , B

100 LOCATE 10,3 : PRINT "TRIANGLE"; TAB(16) "HEXAGONE"; TAB(28) "RECTANGLE"

110 END


OUTPUT




Return to Top