var number = 0;
var newNum = true
var operand = null;
function update(num){
    if (newNum){
        document.getElementById("result").innerHTML += num;
    }else{
        storenum(num);
    }
}

function clearout(){
    number = 0;
    document.getElementById("result").innerHTML = "";
}

function storenum(num){
    var currentNumber =Number(document.getElementById("result").innerHTML);
    switch (operand){
        case '*':
            number = number * currentNumber;
            break;
        case '/':
            number = number / currentNumber;
            break;
        case '+':
            number = number + currentNumber;
            break;
        case '-':
            number = number - currentNumber;
            break;
        default:
            if(number == 0) number = currentNumber;
            break;
    }
    if (num != 0){
        document.getElementById("result").innerHTML = '' + num;
    }
    console.log(number)
    newNum = true;
}

function operation(simbol){
    operand = simbol;
    newNum = false
}

function showresult(){
    storenum(0);
    document.getElementById("result").innerHTML = number;
}