[Prev] [Next] [Contents] [Commodore] [New] [Search] [Home]

This program calculates the value of PI. RUN this program, and after a short while hit the <RUN/STOP> key. You will see the display:

    BREAK IN 20
NOTE: Might be different number.

Type the command PRINT C to see how far the Commodore 64 has gotten. Then use CONT to resume from where the Commodore 64 left off.

COS

TYPE: Function
FORMAT: COS (<number>)

Action: This mathematical function calculates the cosine of the number, where the number is an angle in radians.

EXAMPLES of COS Function:
   10 PRINT COS(0)
   20 X = COS(Y*π/180) : REM CONVERT DEGREES TO RADIANS

DATA

TYPE: Statement
FORMAT: DATA <list of constants>

Action: DATA statements store information within a program. The program uses the information by means of the READ statement, which pulls successive constants from the DATA statements.

The DATA statements don't have to be executed by the program, they only have to be present. Therefore, they are usually placed at the end of the program.

All data statements in a program are treated as a continuous list. Data is READ from left to right, from the lowest numbered line to the highest. If the READ statement encounters data that doesn't fit the type requested (if it needs a number and finds a string) an error message occurs.


[Prev] [Next] [Contents] [Commodore] [New] [Search] [Home]
This page has been created by Sami Rautiainen.
Read the small print. Last updated December 22, 2002.