Some simple Quick Basic Programs-1

Shihab Uddin Ahmed | May 5, 2012

QuickBasic_1These are some common Quick Basic programs by which almost every student starts his programming. Quick Basic is not obsolete yet, it’s still used to introduce students to the programming world. So try this and write more programs! I have run all this programs, so be sure that all the programs are correct.

 

 

***************

1

***************

‘Program to calculate total and average marks of two subjects

MarkInPhysics = 80

MarkInMath = 70

TotalMark = MarkInPhysics + MarkInMath

AverageMark = TotalMark / 2

PRINT TotalMark

PRINT AverageMark

END

 

 

***************

2

***************

 

REM To calculate the total and average mark

CLS

INPUT “Physics”; phy

INPUT “Mathematics”; math

Total = phy + math

Average = Total / 2

PRINT “Total=”; Total

PRINT “Average=”; Average

END

 

***************

3

***************

 

‘This program calculates the total & average marks of two subjects

CLS

READ Physics, Mathematics

Total = Physics + Mathematics

Average = Total / 2

PRINT Physics, Mathematics

 

PRINT Total, Average

DATA 80, 70

END

QuickBasic_2

 

***************

4

***************

 

 

 

‘A program to show digits 1 to 5 on screen

CLS

x% = o

x% = x% + 1

PRINT x%

x% = x% + 1

PRINT x%

x% = x% + 1

PRINT x%

x% = x% + 1

PRINT x%

x% = x% + 1

PRINT x%

END

 

 

***************

5

***************

‘Conversion from Centigrade to Fahrenheit

CLS

INPUT “Temperatune in centigrade scale=”; c

f = (c * 9 / 5) + 32

PRINT “Temperature in Fahrenheit scale=”; f

END

***************

6

***************

REM  Fahrenheit to Centigrade

CLS

INPUT “Enter temperature in Fahrenheit”; f

c = (5 * (f – 32)) / 9

PRINT “Temperature in Centigrade”; c

END

***************

7

***************

‘Kilometer to mile converter

CLS

INPUT “Enter the value of distance in kilometre=”; k

m = k * .625

PRINT “The value of distance in mile is=”; m

END

 

***************

8

***************

‘Mile to kilometer converter

CLS

INPUT “Enter the Value of distance in mile=”; m

k = m * 1.6

PRINT “The value of distance in kilometere is=”; k

END

***************

9

***************

REM Conversion of mile into kilometer and then finding the highest value

CLS

INPUT “How many values do you want to convert and compare”; N

FOR I = 1 TO N

INPUT “Miles=”; M(I)

k(I) = M(I) * 1.609

NEXT I

h = 0: s = 9999

FOR I = 1 TO N

IF h < k(I) THEN h = k(I)

IF s > k(I) THEN s = k(I)

NEXT I

PRINT “Highest value in kilometre is=”; h

PRINT “Smallest value in kilometre is=”; s

PRINT “Mile”, “Kilometre”

FOR I = 1 TO N

PRINT M(I), k(I)

NEXT I

END

 

***************

10

***************

REM Summation of even numbers

CLS

PRINT “Summation of the series: 2+4+6+….+N”

INPUT “Enter the value of N”; N

a: count% = count% + 1

b = count% MOD 2

IF b = 0 THEN sum% = sum% + count%

IF count% < N THEN GOTO a:

PRINT “Summation is=”; sum%

END

 

***************

11

***************

 

‘Summation of the series 1+1/2^3+1/3^3…1/N^3

CLS

PRINT “Summation of the series 1+1/2^3+1/3^3…1/N^3”

INPUT “How many numbers”; N

FOR I = 1 TO N

a = 1 / I ^ 3

s = s + 1 / I ^ 3

PRINT I, a

NEXT I

PRINT “Sum is=”; s

END

***************

12

***************

 REM Summation of the series 1+3+9+27+81+…+N

CLS

INPUT “Please enter the end point”; N

count = count + 1

IF count >= N THEN GOTO a:

IF count < N THEN GOTO b:

b: sum = 1

sum = sum + (sum * 3)

if sum

a: PRINT “total”; t

END

 

***************

13

***************

‘A program to show digits 1 to 5 on screen (But?)

CLS

x% = o

a: x% = x% + 1

PRINT x%

IF x% < 5 THEN GOTO a:

END

 

***************

14

***************

 

 

REM Result sheet of 4th year students

CLS

INPUT “How many students”; N

FOR I = 1 TO N

INPUT “Name of the student”; N$(I)

INPUT “Roll number”; R(I)

INPUT “Computer Science”; C(I)

INPUT “Electronics”; E(I)

T(I) = C(I) + E(I)

Pr(I) = T(I) * 100 / 200

NEXT I

PRINT “………….*************………….”

PRINT “ROll”, “Name”, “Com”, “Elec”, “Result”

PRINT “………….*************………….”

FOR I = 1 TO N

IF Pr(I) >= 33 THEN PRINT R(I), N$(I), C(I), E(I), “Passed”

IF Pr(I) < 33 THEN PRINT R(I), N$(I), C(I), E(I), “Failed”

NEXT I

END

***************

***************

Print Friendly

  • comments powered by Disqus
  • You may also like: