BASIC PROGRAMMING II

BASIC PROGRAMS

FIND SUQARE ROOT OF NUMBERS

10 REM FIND SUQARE ROOT OF NUMBERS

20 INPUT “ENTER FIRST NUMBER OF RANGE”; A

30 INPUT “ENTER LAST NUMBER OF RANGE”; B

40 FOR I = A TO B

50 PRINT “THE SUARE ROOT OF “; A; “IS “;SQR(A)

60 NEXT A

70 END

 

FIND SQUARE ROOT OF S ROUNDED UP TO AN INTEGER

10 REM FIND SUQARE ROOT S

20 INPUT “ENTER NUMBER”; A

30 S = INT(SQR(A))

40 PRINT “THE SQUARE ROOT OF S ROUNDED OFF “;A; “IS “; S

50 END

 

FIND THE COSINE OF KNOW VALUES

10 REM FIND TANGENT OF GIVEN ANGLE

20 INPUT “ENTER NUMBER”; A

30 S = TAN(A)

40 PRINT “THE TANGENT OF “;A; “IS “; S

50 END

 

PLOT SINE WAVE CURVE

We can get the y position of sine wave at any of these 360 points by using the SIN command. Unfortunately the SIN command requires the input Radians but we can convert degrees to radians but multiplying the degrees by 0.017453. so to get the Y position of the sine wave at 90 degrees we would use this

 

PRINT SIN(90*0.017453)

Of course using a scale of -1 to +1 is a bit limited in my opinion and it requires a bit of multiplication and addition so that we can get a range of something like 0 to 100 with 50 being the midpoint. To make this so:

 

10 PRINT (SIN (dg% *0.017453)*50)+50

20 SCREEN 13

30 FOR X%= 0 TO 360

40 PSET (X%, (SIN(X%*0.017453)*50)+50),15

50 NEXT X%

60 END

 

 PLOT COSINE CURVE

20 SCREEN 13

30 FOR x% = 0 to 360

40 PSET (x%, (COS(x%*0.017453)*50)+50),15

50 NEXT x%

60 END

 

ASSESSMENT ® Write a BASIC program to find the tangent of an angle

Student are allowed to give corrections to the assessment given by the teacher ,while the teacher support s them in order to guide them

 

See also

BASIC PROGRAMMING

FLOW CHART

ALGORITHM AND FLOW CHART

PROGRAM DEVELOPMENT

Program Development

Leave a Comment

Your email address will not be published. Required fields are marked *

Get Fully Funded Scholarships

Free Visa, Free Scholarship Abroad

           Click Here to Apply

Acadlly