I have to program a calculator which can calculate a faculty and a eulerian number. these formulars are given:
faculty: Number1! = 1*2*...*Number1
eulerian number: Number1
e= ∑ 1/k!
k=0
I have most of the code, but I don't know how to use thes formulars in my code.
<label for="zahl1"></label>
<input id="zahl1" type="text" placeholder="Zahl eingeben">
<label for="zahl2" type="text"></label>
<input id="zahl2" type="text" placeholder="Zahl eingeben"> <br>
<button id="facultyBtn" class="btn btn-info">F</button>
<button id="eulerschBtn" class="btn btn-info">e</button>
document.getElementById("facultyBtn").addEventListener("click", () => {
const zahl1Input = document.getElementById("zahl1");
const zahl2Input = document.getElementById("zahl2");
const zahl1 = Number(zahl1Input.value);
const zahl2 = Number(zahl2Input.value);
const F =
let ergebnis;
ergebnis = F
const ergebnisInput = document.getElementById("ergebnis");
ergebnisInput.innerText = ergebnis.toString();
})
document.getElementById("eulerschBtn").addEventListener("click", () => {
const zahl1Input = document.getElementById("zahl1");
const zahl2Input = document.getElementById("zahl2");
const zahl1 = Number(zahl1Input.value);
const zahl2 = Number(zahl2Input.value);
const e =
let ergebnis;
ergebnis = e
const ergebnisInput = document.getElementById("ergebnis");
ergebnisInput.innerText = ergebnis.toString();
})
})
So what I am missing in my code is what to write after "const f =" and "const e =" I would really appreciate some help. I am new to programming, but I have to finish this for school.