Some simple Quick Basic Programs-1

Shihab Uddin Ahmed | May 5, 2012

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

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, PDF & Email
  • You may also like: