What I am trying to do is make a loop so that x is increasingly inputted 100 times into a formula times and spit out the result on the screen.
Here is part of my code:
It is the formula to the sawtooth function found here.Code:double sample; P=(10000/262); A=i/P; sample = 2*((A)-(A+.5));
However every time I run this code, the only answers it gives me is -1. I even tried graphing this function in my graphing calculator and it gives me the same answer. Please could you tell me what I am doing wrong?