11.07.2015 Views

Here - 1000 BiT

Here - 1000 BiT

Here - 1000 BiT

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

ROUNDING OFF NUMBERSPerhaps you know about "rounding off" numbers. If the decimal part starts with .5 orabove, you round up; if it starts with .4 or below, you round down.17.02 round down 173.1 down 3103.43 down 1034.5 up 582.917 up 83You round off numbers with the INT function by first adding 0.5 to the number.Run 10 REM ### ROUNDING OFF ###20 PRINT "clr dn sp GIVE ME A DECIMAL NUMBER"25 INPUT N30 PRINT " ROUNDED TO THE NEAREST INTEGER"40 PRINT INT[N +0.5)45 FOR T=1 TO <strong>1000</strong>: NEXTT50 GOTO 20Try the program with numbers like 3.4999 and 3.5, and other numbers you choose.ROLLING THE BONESMost dice games use two dice. One of them is called a "die." <strong>Here</strong> is a program whichacts like rolling a single die.10 REM ///ONE DIE///20 PRINT "clr dn dn dn"30 LET R=RND(8)40 PRINT" RANDOM NUMBER";TAB(15);R50 LET S=R*655 PRINT "dn TIMES 6";TAB(15);S60 LET I=INT(S)65 PRINT "dn INTEGER PART";TAB(15];I70 LET D=l+175 PRINT "dn DIE SHOWS";TAB[15);D80 FOR T=1 TO 2000: NEXT T85 GOTO 2077

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

Saved successfully!

Ooh no, something went wrong!