Here - 1000 BiT

Here - 1000 BiT Here - 1000 BiT

11.07.2015 Views

LESSON 10INTRODUCING NUMBERSINPUT, LET AND PRINTSo far we have only used strings. Numbers can be used too. Enter and run this program:10 PRINT "clr"20 PRINT "GIVE ME A NUMBER"30 INPUT N40 LET A=N+145 PRINT50 PRINT "HERE IS A BIGGER ONE"60 PRINT AARITHMETICThe plus and minus signs are side by side in the top row of the keyboard.Computers use "*" instead of "x" for a multiplication sign.Try this. Change line 40 so that N is multiplied by 5.Computers use "/" for a division sign. It is on the "?" key. Answers are given as decimals.VARIABLESThe name of a box which contains a string must end with a dollar sign. Examples:N$,A$,Z$.The name of a box which contains a number doesn't have a dollar sign. Examples:N, A, Z.60

The thing which is put into the box is called the "value" of the variable.ARITHMETIC IN THE LET COMMAND10LETA=200120 LET B=198330 LET C=A-B40 PRINT "HOW MUCH LONGER, HAL?"50 PRINT C;" YEARS"CAREFUL!Numbers and strings are different. Example: "1984" is not a number. It is a stringconstant because it is in quotes.RULE: Even if a string is made up of number characters, it is still not a number.Some numeric constants: 5, 22,3.14, -50Some string constants: "HI", "7", "TWO", "3.14"61

The thing which is put into the box is called the "value" of the variable.ARITHMETIC IN THE LET COMMAND10LETA=200120 LET B=198330 LET C=A-B40 PRINT "HOW MUCH LONGER, HAL?"50 PRINT C;" YEARS"CAREFUL!Numbers and strings are different. Example: "1984" is not a number. It is a stringconstant because it is in quotes.RULE: Even if a string is made up of number characters, it is still not a number.Some numeric constants: 5, 22,3.14, -50Some string constants: "HI", "7", "TWO", "3.14"61

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!