+ 1
What is "!"
So i am currently doing some exercices in Java and i have this formula "S = 1 + 1!/x + 2!/x^2 + .... + N!/x^N " soo my question is what are those !-s before / ? Thanks in advance :)
4 Respuestas
+ 9
In math ! is factorial.
5! = 1 * 2 * 3 * 4 *5
3! = 1 * 2 * 3
+ 4
In programming the ! has another meaning. In your code it means "not". It's used to negate boolean values or to compare 2 values (!= means "is not")
To calculate the factorial you need to make a function for it where you pass the number in and get the result back. The result then gets used in the formula
+ 3
Hint: The first part of the formula (1) is actually 0! / x^0
+ 2
Thank you :)