I have created some programs for some random things in my classes. My current program is dealing with percentages and what I want it to do is to add all the inputs together once the program is done. Obvously it's not as simple as just A+b+c->d.
What I have is a single program that does the calculations, then when it finishes the calculations it asks for "Finished? Y/N", and you put in Y or N. N ends the program, Y does a "goto" back above.
So what I want it to do is when I click Y, it saves the previous number, goes through the program again, then adds it to make a cumulative percentage of both. Is there any way to get a program to save the variables together.
To make a better point of what I mean, I will write the program here. when I do "=" it's actually -> or the sto-> command for ease of use
Program: factoria
Disp: "successful probability?"
Input P
1-P=q
prompt N
lbl x
prompt B
n-b=c
(N!)/((b!)*c!))=D
D*p^B*q^c=e
Disp "PDF,Mean,Sigma"
Disp E,Z,W
Disp "continue?"
Input "y/n",Str1
then
goto x
else
end
So what I want it actually to do is, save E, (Z, and W, the mean and sigma will not change) then when you go to Y, and do the problem again, is to add the TWO E's together, then display them AFTER you click N. Hypothetically, if you continued the program a bunch of times, say 10 times, it adds the 10 different numbers together, then displays them at the end.
I don't really know if this is possible to do, I don't know how to get the numbers to save, then add at the end.
Side not, if you're in statistics, nCr, is n choose r, which is the factorial equation that I was doing, doesn't work in program? nCr is a lot more efficient, as it does the equations a little differently. When you do factorials, you can divide out numbers to make the numbers smaller, thus preventing a "overflow" in most cases. However, nCr doesn't work right in programs? Is there some way to use nCr in a program? and have the variables go into a nCr? Hypothetically, having it be "n"C"b"->D is more efficient than the weird factorial thing I made. Overflows are HUGELY common with factorials, because it's multiplying by all numbers below it. So 5! would be 5x4x3x2x1, so when you get into the 100s you deal a lot with overflows.
Any ideas how to get these to add cumulatively and to get nCr to work in program? Also, if you have any suggestions to the program that would make it more efficient I'd love to hear it, love to take notes on how to make it better to have it work in different programs. Such thing would be to have the Continue, y/n, be click enter on yes or no. Rather than to have to do Alpha 1 for y and alpha log for n. Don't really know if it's possible though.
What I have is a single program that does the calculations, then when it finishes the calculations it asks for "Finished? Y/N", and you put in Y or N. N ends the program, Y does a "goto" back above.
So what I want it to do is when I click Y, it saves the previous number, goes through the program again, then adds it to make a cumulative percentage of both. Is there any way to get a program to save the variables together.
To make a better point of what I mean, I will write the program here. when I do "=" it's actually -> or the sto-> command for ease of use
Program: factoria
Disp: "successful probability?"
Input P
1-P=q
prompt N
lbl x
prompt B
n-b=c
(N!)/((b!)*c!))=D
D*p^B*q^c=e
Disp "PDF,Mean,Sigma"
Disp E,Z,W
Disp "continue?"
Input "y/n",Str1
then
goto x
else
end
So what I want it actually to do is, save E, (Z, and W, the mean and sigma will not change) then when you go to Y, and do the problem again, is to add the TWO E's together, then display them AFTER you click N. Hypothetically, if you continued the program a bunch of times, say 10 times, it adds the 10 different numbers together, then displays them at the end.
I don't really know if this is possible to do, I don't know how to get the numbers to save, then add at the end.
Side not, if you're in statistics, nCr, is n choose r, which is the factorial equation that I was doing, doesn't work in program? nCr is a lot more efficient, as it does the equations a little differently. When you do factorials, you can divide out numbers to make the numbers smaller, thus preventing a "overflow" in most cases. However, nCr doesn't work right in programs? Is there some way to use nCr in a program? and have the variables go into a nCr? Hypothetically, having it be "n"C"b"->D is more efficient than the weird factorial thing I made. Overflows are HUGELY common with factorials, because it's multiplying by all numbers below it. So 5! would be 5x4x3x2x1, so when you get into the 100s you deal a lot with overflows.
Any ideas how to get these to add cumulatively and to get nCr to work in program? Also, if you have any suggestions to the program that would make it more efficient I'd love to hear it, love to take notes on how to make it better to have it work in different programs. Such thing would be to have the Continue, y/n, be click enter on yes or no. Rather than to have to do Alpha 1 for y and alpha log for n. Don't really know if it's possible though.