Ive tried replacing the n with 3, but keep getting errors, WHY??
Accepted Reply
You still haven't told us the specific error message.
In any case, you'll need to include the multiply operator, `*`, to make the arithmetic expression valid.
n * (n + 1) / 2
If that's the fix, don't bother posting the error message. 🙂
Replies
Can you show preciselywhat you want to achieve with the code and the error, not just in the title of the thread.
What do you mean with <- operator ?
n (n + 1) / 2 is a formula, but for some reason when i put that into xcode, i get an error message, even when i replace the n with numbers i still get errors. Here is the actual problem:
A triangular number can also be generated by the formula:
triangularNumber = n (n + 1) / 2
for any integer value of n. For example, the 10th triangular number number, 55, can be generated by substituting 10 as the value for n in the preceding formula.
......ps the -->> is just to point out the formula.
You still haven't told us the specific error message.
In any case, you'll need to include the multiply operator, `*`, to make the arithmetic expression valid.
n * (n + 1) / 2
If that's the fix, don't bother posting the error message. 🙂