Just learned programming, got an easy question.

Discussion in 'Computer Science & Culture' started by snakeyez, Feb 11, 2003.

Thread Status:
Not open for further replies.
  1. snakeyez Registered Member

    Messages:
    8
    Okay, first of all, hello. This is my first post, although I have been lurking for a couple of weeks just learning some interesting stuff. I am a student, and I don't know anything about programming except what I have taught myself by reading the manual on my calculator. I have one of those TI-86 calculators and I am trying to figure out For loops, and I am stuck.

    Here is my situation, I am trying to write a program that takes totals of numbers and just adds them up. I believe the language is called BASIC. Here is what i have so far:

    :Input "How many numbers?", A
    :For(B,1,A)
    :Input "Number=", C

    Please Register or Log in to view the hidden image!

    ??

    Okay, I want the program to take all the numbers you enter and add them up, but I dont know how to get the new variable C, to get added to the previous variable C.

    Example of how i want it to work:
    "How many numbers?" 2
    "Number=" 3
    "Number=" 3
    "Answer=" 6

    Sorry for the dumb question, but like I said, I have been doing this for about 4 days. Thanx
     
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. testify Look, a puppy! Registered Senior Member

    Messages:
    508
    I used to know how to do this for the TI-83 and I suspect it's the same thing for the TI-86. The best resource you can have is the manual. Check in the manual for the loop syntax (I think it's goto loops) or another thing you can do is check out the TI website, download the program editting software and take a look at some premade programs.
     
  4. Google AdSense Guest Advertisement



    to hide all adverts.
  5. LSatyl Registered Senior Member

    Messages:
    44
    First of all, I got all the info from TI 86 guidebook. I hope (and assume) this is the one you own.

    The code (I used E as a variable name, because a colon and a D end up being

    Please Register or Log in to view the hidden image!

    ):

    :E =0
    :Input "How many numbers?", A
    :For(B,1,A)
    :Input "Number=", C
    :E = E + C
    :End

    Please Register or Log in to view the hidden image!

    utput(1,1,"Answer =")

    Please Register or Log in to view the hidden image!

    utput(1,10,E)

    Since I don't have a TI 86 handy, you'll have to check if this works

    Please Register or Log in to view the hidden image!



    HTH
     
  6. Google AdSense Guest Advertisement



    to hide all adverts.
  7. snakeyez Registered Member

    Messages:
    8
    Thanks, that was exactly what I was looking for

    Please Register or Log in to view the hidden image!

     
  8. Redrover Registered Senior Member

    Messages:
    234
    Ti calculator programming! Oh the memories!

    I haven't played around with a TI-86, but on the TI-80 & TI-83, the "=" sign is actually (in C++) a "==" sign so maybe you have to write it this way:

    :E =0
    :Input "How many numbers?", A
    :For(B,1,A)
    :Input "Number= ", C
    :E + C -> E
    :End

    Please Register or Log in to view the hidden image!

    isp "Answer", E

    BTW, "->" is the arrow sign with "sto" written next to it and which basically means "is stored in"
     
Thread Status:
Not open for further replies.

Share This Page