Shop OBEX P1 Docs P2 Docs Learn Events
use pbasic to divide the 2345 number into 4 individual number 2,3,4,5 — Parallax Forums

use pbasic to divide the 2345 number into 4 individual number 2,3,4,5

hsiaochunghsiaochung Posts: 17
edited 2008-08-17 14:52 in BASIC Stamp
I have a number 2345
how can i divide the 2345 number into 4 individual number 2,3,4,5
which command in PBasic can do above function

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-08-17 13:48
    The operator DIG. Look in the PBasic Manual index.
  • hsiaochunghsiaochung Posts: 17
    edited 2008-08-17 14:16
    Thanks Mike

    how could i transfer a num to its ASCII
    such as 0 its ascii code is 48
    which operator can do that

    Post Edited (hsiaochung) : 8/17/2008 2:55:16 PM GMT
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2008-08-17 14:19
    The ASCII code for "0" is $30, "1" is $31, "2" is $32...· Noticing a pattern?
  • Mike GreenMike Green Posts: 23,101
    edited 2008-08-17 14:40
    Add "0" or $30 like

    (2345 DIG 1) + "0"
  • hsiaochunghsiaochung Posts: 17
    edited 2008-08-17 14:52
    Thanks for Mike again

    I use the below statements

    (2345 DIG 1) + 48
Sign In or Register to comment.