I have a problem with my calculator with subtraction I used my variable called rezultat and I do every operation for default rezultat is 0 and I have one more variable that I remember all my previous inputs for operations that variable called pamti_broj, now when I try to do subtraction I do something like this 0 = 12 - 0 then I got - 12 if I try to subtract example 12 - 3 I will got -15 because I don't know how can I do that logically in my function oduzimaj can some one help me how can I do that here is the code, I have a problem with a function oduzimaj I don't know how it is set up that function if anyone can help me? I'm trying to create something like windows 10 calculator
function oduzimaj(){ rezultat = pamti_broj - rezultat; // Here is the problem ispis.innerHTML = rezultat; pamti_broj = 0; // Resetujemo sve po defaultu decimale = 1; pamti_tacku = false; operacija = true; // Vrsimo operaciju vrsimo[1] = "-"; // Na mestu broj jedan u array-u dodajemo operaciju oduzimanje }
https://stackoverflow.com/questions/66913428/i-want-to-create-a-calculator-i-have-a-problem-with-subtractions April 02, 2021 at 09:29AM
没有评论:
发表评论