BASIC programs
We want to return to learn BASIC programming language.
There are, SIN, COS, TAN, in BASIC programming language.
ATN (Arc TAN), ASN (Arc AIN), ACN (Arc COS), COT (Co TAN), too.
Basically, BASIC programming language has, SIN, COS, TAN.
10 REM SIN
20 PRINT SIN(PI)
30 END
Then run,
Answer is 0.
10 REM COS
20 PRINT COS(PI)
30 END
Then run,
Answer is 1.
TAN = SIN / COS.
10 REM TAN
20 PRINT TAN(PI)
30 END
Then run,
Answer is 0.
10 REM SIN version 2
20 INPUT I
30 PRINT SIN(I)
40 END
We can calculate SIN.
PI is The ratio of the circumference of a circle to its diameter (Apple Dictionary), 3.14159276.....
Do you know this ?
sin^2(theta) + cos^2(theta) = 1
Let us try !
10 REM SIN+COS
20 PRINT ((SIN(PI))^2 + (COS(PI))^2)
30 END
Then run,
Answer is 1.
10 REM SIN+COS version 2
20 INPUT I
30 PRINT ((SIN(I))^2 + (COS(I))^2)
40 END
Then run,
This answer is always almost 1.
We used ^ in this program.
^ means square number.
10 REM SQUARE 4
20 PRINT 4^2
30 END
Then run,
Answer is 16.
Next, we want to learn GOTO.
10 REM GOTO
20 INPUT I
30 IF I<0 GOTO 100
40 PRINT I
50 END
100 PRINT (0 - I)
110 END
IF statement and GOTO statement exchanges program route by conditions.
We programmed this.
10 REM AI
20 INPUT A$
30 PRINT A$
40 GOTO 20
50 END
This program loops between line number 20 and line number 40.
Homework: Make BASIC programs for many calculations. Make all flow charts for all programs in this article.
Exercise
Make program and flow chart.
1 Add 1 to 100
2 Add 1 and 4
3 Divide 4/3
4 Show text "Hello"
5 Write this "Tomato is", I (INPUT I)
6 Write COS(I) calculate program (INPUT I)
7 Write I^2 calculate program
8 Write DIM (I,J), Add DIM (I fixed, J loop)
9 Write DIM (I,J) Add DIM (I loop, J loop)
10 Can you calculate how many days from your birth ? (Difficult)
Extra Exercise (Difficult)
Write BIORHYTHM
(R.S.F. toshiki speed news press, Agence France-Presse, 1 Monday September 2014 The Roman)